Skip to content

Commit

Permalink
fix all remaining bracket tests… (#301)
Browse files Browse the repository at this point in the history
…that don't involve character classes.
  • Loading branch information
Byron committed Apr 13, 2022
1 parent c64f71c commit 3afe2d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions git-glob/src/wildmatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ pub(crate) mod function {
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()
if (t_ch_upper <= p_ch.to_ascii_uppercase()
&& t_ch_upper >= prev_p_ch.to_ascii_uppercase())
|| (t_ch_upper <= prev_p_ch.to_ascii_uppercase()
&& t_ch_upper >= p_ch.to_ascii_uppercase())
{
matched = true;
}
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 @@ -244,10 +244,10 @@ fn corpus() {
}

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

fn multi_match(pattern_text: &str, text: &str) -> (Pattern, MultiMatch) {
Expand Down

0 comments on commit 3afe2d2

Please sign in to comment.