Add broken tests for regressions
See and
@@ -347,6 +347,37 @@ async fn multipath_allow_on_any_one_pass() {
assert!(filterer.check_event(&event).unwrap());
}
+#[tokio::test]
+async fn extensions_and_filters_glob() {
+ let filterer = filt(&["*/justfile"], &[], &["md", "css"]).await;
+
+ filterer.file_does_pass("justfile");
+ filterer.file_does_pass("foo/justfile");
+ filterer.file_does_pass("bar.md");
+ filterer.file_does_pass("qux.css");
+ filterer.file_doesnt_pass("nope.py");
+}
+
+#[tokio::test]
+async fn extensions_and_filters_slash() {
+ let filterer = filt(&["/justfile"], &[], &["md", "css"]).await;
+
+ filterer.file_does_pass("justfile");
+ filterer.file_does_pass("bar.md");
+ filterer.file_does_pass("qux.css");
+ filterer.file_doesnt_pass("nope.py");
+}
+
+#[tokio::test]
+async fn leading_single_glob_file() {
+ let filterer = filt(&["*/justfile"], &[], &[]).await;
+
+ filterer.file_does_pass("justfile");
+ filterer.file_does_pass("foo/justfile");
+ filterer.file_doesnt_pass("notfile");
+ filterer.file_doesnt_pass("not/thisfile");
+}
+
#[tokio::test]
async fn nonpath_event_passes() {
use watchexec::{
