Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
add tests for glob patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
leops committed Dec 13, 2022
1 parent e2c7217 commit c95ea00
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions crates/rome_service/src/matcher/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,4 +895,33 @@ mod test {
.matches_path(Path::new("\\\\?\\C:/a/b")));
}
}

#[test]
fn test_pattern_glob() {
assert!(Pattern::new("*.js")
.unwrap()
.matches_path(Path::new("b/c.js")));

assert!(Pattern::new("**/*.js")
.unwrap()
.matches_path(Path::new("b/c.js")));

assert!(Pattern::new("*.js")
.unwrap()
.matches_path(Path::new("/a/b/c.js")));

assert!(Pattern::new("**/*.js")
.unwrap()
.matches_path(Path::new("/a/b/c.js")));

if cfg!(windows) {
assert!(Pattern::new("*.js")
.unwrap()
.matches_path(Path::new("C:\\a\\b\\c.js")));

assert!(Pattern::new("**/*.js")
.unwrap()
.matches_path(Path::new("\\\\?\\C:\\a\\b\\c.js")));
}
}
}

0 comments on commit c95ea00

Please sign in to comment.