Skip to content

Commit d02dcbc

Browse files
milkorysylvestre
authored andcommitted
fix up test on windows
1 parent 33852ad commit d02dcbc

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/find/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,9 +1576,10 @@ mod tests {
15761576

15771577
#[test]
15781578
fn test_finished_in_root_directory() {
1579-
let mut config = Config::default();
1580-
config.max_depth = 1;
1581-
1579+
let config = Config {
1580+
max_depth: 1,
1581+
..Default::default()
1582+
};
15821583
let deps = FakeDependencies::new();
15831584
let mut quit = false;
15841585
let matcher = FakeMatcher::new();

tests/find_exec_tests.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,19 @@ fn find_execdir_multi_in_root_directory() {
217217
.unwrap();
218218
let temp_dir_path = temp_dir.path().to_string_lossy();
219219
let deps = FakeDependencies::new();
220+
221+
let cwd = env::current_dir().expect("no current directory");
222+
let root_dir = cwd
223+
.ancestors()
224+
.last()
225+
.expect("current directory has no root");
226+
220227
// only look at files because the "size" of a directory is a system (and filesystem)
221228
// dependent thing and we want these tests to be universal.
222229
let rc = find_main(
223230
&[
224231
"find",
225-
&fix_up_slashes("/"),
232+
&fix_up_slashes(&root_dir.to_string_lossy()),
226233
"-maxdepth",
227234
"0",
228235
"-execdir",
@@ -246,5 +253,12 @@ fn find_execdir_multi_in_root_directory() {
246253
let mut s = String::new();
247254
f.read_to_string(&mut s)
248255
.expect("failed to read output file");
249-
assert_eq!(s, "cwd=/\nargs=\n)\n--sort\n/\n");
256+
assert_eq!(
257+
s,
258+
fix_up_slashes(&format!(
259+
"cwd={}\nargs=\n)\n--sort\n{}\n",
260+
root_dir.to_string_lossy(),
261+
root_dir.to_string_lossy(),
262+
))
263+
);
250264
}

0 commit comments

Comments
 (0)