mirror of
https://github.com/RGBCube/alejandra
synced 2025-08-01 04:57:44 +00:00
test: increase coverage
This commit is contained in:
parent
b6679fa6e3
commit
4e873a1fe4
1 changed files with 4 additions and 21 deletions
|
@ -43,14 +43,6 @@ impl Children {
|
||||||
Children { children, current_index: 0 }
|
Children { children, current_index: 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn count(&self) -> usize {
|
|
||||||
self.children.len()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn current_index(&self) -> usize {
|
|
||||||
self.current_index
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get(&mut self, index: usize) -> Option<Child> {
|
pub fn get(&mut self, index: usize) -> Option<Child> {
|
||||||
if index + 1 > self.children.len() {
|
if index + 1 > self.children.len() {
|
||||||
None
|
None
|
||||||
|
@ -66,14 +58,9 @@ impl Children {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_remaining(&mut self) -> Vec<Child> {
|
pub fn get_remaining(&mut self) -> Vec<Child> {
|
||||||
if self.current_index < self.children.len() {
|
let remaining = &self.children[self.current_index..self.children.len()];
|
||||||
let remaining =
|
self.current_index = self.children.len();
|
||||||
&self.children[self.current_index..self.children.len()];
|
remaining.to_vec()
|
||||||
self.current_index = self.children.len();
|
|
||||||
remaining.to_vec()
|
|
||||||
} else {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_next(&self) -> bool {
|
pub fn has_next(&self) -> bool {
|
||||||
|
@ -85,11 +72,7 @@ impl Children {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn peek_prev(&mut self) -> Option<Child> {
|
pub fn peek_prev(&mut self) -> Option<Child> {
|
||||||
if self.current_index >= 1 {
|
self.get(self.current_index - 1)
|
||||||
self.get(self.current_index - 1)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn move_next(&mut self) {
|
pub fn move_next(&mut self) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue