Open azdavis opened 4 days ago
repo with test case here: https://github.com/azdavis/wax-trouble
tldr is: given this directory structure:
testing \ _ a \ _ foo.txt \ _ b \ _ foo.txt
and this rust code:
#[test] fn hm() { let all_foo = "**/foo.txt"; let pwd = std::env::current_dir().unwrap(); let testing_dir = pwd.join("testing"); let testing_dir = testing_dir.as_os_str().to_str().unwrap(); let glob_rooted_at_dir_walk_anything: Vec<_> = go(&format!("{testing_dir}/{all_foo}"), "."); let glob_un_rooted_walk_in_dir: Vec<_> = go(all_foo, &testing_dir); assert_eq!(glob_rooted_at_dir_walk_anything, glob_un_rooted_walk_in_dir); } pub fn go(glob: &str, walk: &str) -> Vec<std::path::PathBuf> { wax::Glob::new(glob) .unwrap() .walk(walk) .map(|x| x.unwrap().into_path()) .collect() }
i would expect the test to pass but it does not. it fails with:
thread 'hm' panicked at src/lib.rs:9:5: assertion `left == right` failed left: [] right: [".../wax-trouble/testing/a/foo.txt", ".../wax-trouble/testing/b/foo.txt"]
where ... is the absolute path containing the repo.
...
i would not expect the lhs (glob_rooted_at_dir_walk_anything) to be empty. i would expect it to be the same as the rhs (glob_un_rooted_walk_in_dir).
glob_rooted_at_dir_walk_anything
glob_un_rooted_walk_in_dir
repo with test case here: https://github.com/azdavis/wax-trouble
tldr is: given this directory structure:
and this rust code:
i would expect the test to pass but it does not. it fails with:
where
...
is the absolute path containing the repo.i would not expect the lhs (
glob_rooted_at_dir_walk_anything
) to be empty. i would expect it to be the same as the rhs (glob_un_rooted_walk_in_dir
).