Skip to content

Commit

Permalink
test: issue #18
Browse files Browse the repository at this point in the history
  • Loading branch information
vladkens committed Oct 21, 2024
1 parent 7b48ab4 commit 561a747
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,4 +381,24 @@ mod tests {
assert!(!r.is_included("abc/123", false, true)); // no wildcard for archived
assert!(r.is_included("abc/xyz", false, true)); // explicitly added
}

#[test]
fn test_issue18() {
// test order of rules not affecting the result
let rules = vec!["foo/*,!foo/bar", "!foo/bar,foo/*"];
for r in rules {
let r = &GhsFilter::new(r);
assert!(!r.is_included("foo/bar", false, false)); // explicitly excluded
assert!(!r.is_included("abc/abc", false, false)); // not included by default
assert!(r.is_included("foo/baz", false, false)); // wildcard included
}

let rules = vec!["foo/*,!fork", "!fork,foo/*"];
for r in rules {
let r = &GhsFilter::new(r);
assert!(r.is_included("foo/bar", false, false)); // wildcard included
assert!(!r.is_included("foo/bar", true, false)); // forks excluded
assert!(!r.is_included("abc/abc", false, false)); // not included by default
}
}
}

0 comments on commit 561a747

Please sign in to comment.