Skip to content

Commit 357ba13

Browse files
committed
assure a prefixed entries range is never empty.
That way it's easier not to accidentally do nothing - nothing changes, just some tests have been added to assure this seems to be the case.
1 parent 995bc84 commit 357ba13

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

gix-index/tests/index/access.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,16 @@ fn prefixed_entries() {
152152
check_prefix(&file, "x", &["x"]);
153153
check_prefix(&file, "b", &["b"]);
154154
check_prefix(&file, "c", &["c"]);
155+
156+
assert_eq!(
157+
file.prefixed_entries_range("".into()),
158+
Some(0..11),
159+
"empty prefixes match everything"
160+
);
161+
assert!(
162+
file.prefixed_entries_range("foo".into()).is_none(),
163+
"there is no match for this prefix"
164+
);
155165
}
156166

157167
fn check_prefix(index: &gix_index::State, prefix: &str, expected: &[&str]) {

0 commit comments

Comments
 (0)