summaryrefslogtreecommitdiffstats
path: root/vendor/gix-glob/tests/search
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/gix-glob/tests/search
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-glob/tests/search')
-rw-r--r--vendor/gix-glob/tests/search/pattern.rs22
1 files changed, 15 insertions, 7 deletions
diff --git a/vendor/gix-glob/tests/search/pattern.rs b/vendor/gix-glob/tests/search/pattern.rs
index 0313b5564..6b62ee3d2 100644
--- a/vendor/gix-glob/tests/search/pattern.rs
+++ b/vendor/gix-glob/tests/search/pattern.rs
@@ -18,16 +18,12 @@ mod list {
fn bytes_to_patterns(_bytes: &[u8], _source: &Path) -> Vec<Mapping<Self::Value>> {
vec![]
}
-
- fn may_use_glob_pattern(_pattern: &gix_glob::Pattern) -> bool {
- unreachable!("won't be called")
- }
}
#[test]
fn from_bytes_base() {
{
- let list = List::<Dummy>::from_bytes(&[], "a/b/source", None);
+ let list = List::<Dummy>::from_bytes(&[], "a/b/source".into(), None);
assert_eq!(list.base, None, "no root always means no-base, i.e. globals lists");
assert_eq!(
list.source.as_deref(),
@@ -52,7 +48,7 @@ mod list {
}
{
- let list = List::<Dummy>::from_bytes(&[], "a/b/source", Some(Path::new("c/")));
+ let list = List::<Dummy>::from_bytes(&[], "a/b/source".into(), Some(Path::new("c/")));
assert_eq!(
list.base, None,
"if root doesn't contain source, it silently skips it as base"
@@ -67,7 +63,7 @@ mod list {
#[test]
fn strip_base_handle_recompute_basename_pos() {
- let list = List::<Dummy>::from_bytes(&[], "a/b/source", Some(Path::new("")));
+ let list = List::<Dummy>::from_bytes(&[], "a/b/source".into(), Some(Path::new("")));
assert_eq!(
list.base.as_ref().expect("set"),
"a/b/",
@@ -87,4 +83,16 @@ mod list {
"otherwise the basename is recomputed, case folding is effective"
);
}
+
+ #[test]
+ fn from_file() {
+ let mut buf = Vec::new();
+ for path in [
+ Path::new(".").join("non-existing-dir").join("pattern-file"),
+ Path::new("file").to_owned(),
+ ] {
+ let list = List::<Dummy>::from_file(path, None, false, &mut buf).expect("no io error");
+ assert!(list.is_none(), "the file does not exist");
+ }
+ }
}