Skip to content

Commit e9ff9d2

Browse files
committed
[find] fix macos specific problems
1 parent 736b820 commit e9ff9d2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

file/tests/find/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ fn find_size_test() {
2727
let test_dir = format!("{}/tests/find/other", project_root);
2828
let args = [&test_dir, "-size", "+4"];
2929

30+
// The different result of the command is due to a feature of the linux and macos operating systems,
31+
// namely the use of different file systems (ext4 on linux and APFS on macos).
32+
// Therefore, the size of folders differs depending on the operating system.
33+
#[cfg(not(target_os = "macos"))]
3034
let expected_output = format!("{}\n{}/file1.txt\n", test_dir, test_dir);
3135

36+
#[cfg(target_os = "macos")]
37+
let expected_output = format!("{}/file1.txt\n", test_dir);
38+
3239
run_test_find(&args, &expected_output, "", 0)
3340
}
3441

@@ -69,8 +76,15 @@ fn find_combination_test() {
6976
let test_dir = format!("{}/tests/find/other", project_root);
7077
let args = [&test_dir, "-size", "+4", "-print", "-size", "+2", "-print"];
7178

79+
// The different result of the command is due to a feature of the linux and macos operating systems,
80+
// namely the use of different file systems (ext4 on linux and APFS on macos).
81+
// Therefore, the size of folders differs depending on the operating system.
82+
#[cfg(not(target_os = "macos"))]
7283
let expected_output = format!("{}\n{}\n{}/file1.txt\n{}/file1.txt\n", test_dir, test_dir, test_dir, test_dir);
7384

85+
#[cfg(target_os = "macos")]
86+
let expected_output = format!("{}/file1.txt\n{}/file1.txt\n", test_dir, test_dir);
87+
7488
run_test_find(&args, &expected_output, "", 0)
7589
}
7690

0 commit comments

Comments
 (0)