Skip to content

Commit

Permalink
more bracket-range tests succeed (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 13, 2022
1 parent 97aa9ed commit c64f71c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions git-glob/src/wildmatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ pub(crate) mod function {
}
if t_ch <= p_ch && t_ch >= prev_p_ch {
matched = true;
} else if mode.contains(Mode::IGNORE_CASE) && t_ch.is_ascii_lowercase() {
let t_ch_upper = t_ch.to_ascii_uppercase();
if t_ch_upper <= p_ch.to_ascii_uppercase()
&& t_ch_upper >= prev_p_ch.to_ascii_uppercase()
{
matched = true;
}
}
prev_p_ch = 0;
}
Expand Down
6 changes: 3 additions & 3 deletions git-glob/tests/wildmatch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ fn corpus() {
(0,0,0,0, "q", "[a-c[:digit:]x-z]"),

// Additional tests, including some malformed wild(patterns
(1,1,1,1, "]", "[\\-^]"),
(0,0,0,0, "[", "[\\-^]"),
(1,1,1,1, "]", r"[\\-^]"),
(0,0,0,0, "[", r"[\\-^]"),
(1,1,1,1, "-", r"[\-_]"),
(1,1,1,1, "]", r"[\]]"),
(0,0,0,0, r"\]", r"[\]]"),
Expand Down Expand Up @@ -245,7 +245,7 @@ fn corpus() {

#[test]
fn empty_brackets() {
let (_pattern, actual) = multi_match("a[]]b", "a]b");
let (_pattern, actual) = multi_match(r"[A-\\]", "G");
assert!(!actual.any_panicked());
assert_eq!(actual, expect_multi(1, 1, 1, 1));
}
Expand Down

0 comments on commit c64f71c

Please sign in to comment.