Skip to content
Myr

Modify test.sh for macOS, fixes #44

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by David Peter · parent eb72875 · Browse files · 1 file+40 added−37 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+40 added−37 removed

  • tests:+40 added−37 removed

1 file+40 added−37 removed

modified:tests/test.sh+40 added-37 removed
26 unmodified lines
27 tmp_output="$(mktemp -t "$MKTEMP_TEMPLATE")"2829 echo "$expected_output" > "$tmp_expected"3031 "$fd" "$@" | sort > "$tmp_output"31 "$fd" "$@" | sort -f > "$tmp_output"3233 echo -ne " ${bold}▶${reset} Testing 'fd $*' ... "3435 if diff -q "$tmp_expected" "$tmp_output" > /dev/null; then
5 unmodified lines
4142 echo -ne "\nShowing diff between ${red}expected${reset} and "43 echo -e "${green}actual${reset} output:\n"4445 diff -C3 --label expected --label actual --color \45 diff -C3 --label expected --label actual \46 "$tmp_expected" "$tmp_output" || true4748 rm -f "$tmp_expected" "$tmp_output"49
11 unmodified lines
6162touch a.foo63touch one/b.foo64touch one/two/c.foo65touch one/two/C.Foo65touch one/two/C.Foo266touch one/two/three/d.foo67mkdir one/two/three/directory_foo68touch ignored.foo69touch .hidden.foo
10 unmodified lines
80expect "one/two/three/d.foo" d.foo81expect "a.foo82one/b.foo83one/two/c.foo84one/two/C.Foo84one/two/C.Foo285one/two/three/d.foo86one/two/three/directory_foo" foo87expect "a.foo88one89one/b.foo90one/two91one/two/c.foo92one/two/C.Foo92one/two/C.Foo293one/two/three94one/two/three/d.foo95one/two/three/directory_foo96symlink" # run 'fd' without arguments9798suite "Explicit root path"99expect "one/b.foo100one/two/c.foo101one/two/C.Foo101one/two/C.Foo2102one/two/three/d.foo103one/two/three/directory_foo" foo one104expect "one/two/three/d.foo105one/two/three/directory_foo" foo one/two/three
1 unmodified line
107cd one/two108expect "../../a.foo109../b.foo110c.foo111C.Foo111C.Foo2112three/d.foo113three/directory_foo" foo ../../114)115116suite "Regex searches"117expect "a.foo118one/b.foo119one/two/c.foo120one/two/C.Foo" '[a-c].foo'120one/two/C.Foo2" '[a-c].foo'121expect "a.foo122one/b.foo123one/two/c.foo" --case-sensitive '[a-c].foo'124125126127suite "Smart case"128expect "one/two/c.foo129one/two/C.Foo" c.foo130expect "one/two/C.Foo" C.Foo131expect "one/two/C.Foo" Foo129one/two/C.Foo2" c.foo130expect "one/two/C.Foo2" C.Foo131expect "one/two/C.Foo2" Foo132133134suite "Case-sensitivity (--case-sensitive)"135expect "one/two/c.foo" --case-sensitive c.foo136expect "one/two/C.Foo" --case-sensitive C.Foo136expect "one/two/C.Foo2" --case-sensitive C.Foo137138139suite "Full path search (--full-path)"140expect "one/two/three/d.foo
1 unmodified line
142expect "a.foo" --full-path '^a\.foo$'143144145suite "Hidden files (--hidden)"146expect "a.foo147.hidden.foo146expect ".hidden.foo147a.foo148one/b.foo149one/two/c.foo150one/two/C.Foo150one/two/C.Foo2151one/two/three/d.foo152one/two/three/directory_foo" --hidden foo153154
1 unmodified line
156expect "a.foo157ignored.foo158one/b.foo159one/two/c.foo160one/two/C.Foo160one/two/C.Foo2161one/two/three/d.foo162one/two/three/directory_foo" --no-ignore foo163164expect "a.foo165.hidden.foo164expect ".hidden.foo165a.foo166ignored.foo167one/b.foo168one/two/c.foo169one/two/C.Foo169one/two/C.Foo2170one/two/three/d.foo171one/two/three/directory_foo" --hidden --no-ignore foo172173174suite "Symlinks (--follow)"175expect "one/two/c.foo176one/two/C.Foo176one/two/C.Foo2177symlink/c.foo178symlink/C.Foo" --follow c.foo178symlink/C.Foo2" --follow c.foo179180181suite "Maximum depth (--max-depth)"182expect "a.foo183one184one/b.foo185one/two186one/two/c.foo187one/two/C.Foo187one/two/C.Foo2188one/two/three189symlink" --max-depth 3190expect "a.foo191one
3 unmodified lines
195expect "a.foo196one197symlink" --max-depth 1198199abs_path=$(python -c "import os; print(os.path.realpath('$root'))")200201suite "Absolute paths (--absolute-path)"201expect "$root/a.foo202$root/one/b.foo203$root/one/two/c.foo204$root/one/two/C.Foo205$root/one/two/three/d.foo206$root/one/two/three/directory_foo" --absolute-path foo207expect "$root/a.foo208$root/one/b.foo209$root/one/two/c.foo210$root/one/two/C.Foo211$root/one/two/three/d.foo212$root/one/two/three/directory_foo" foo "$root"202expect "$abs_path/a.foo203$abs_path/one/b.foo204$abs_path/one/two/c.foo205$abs_path/one/two/C.Foo2206$abs_path/one/two/three/d.foo207$abs_path/one/two/three/directory_foo" --absolute-path foo208expect "$abs_path/a.foo209$abs_path/one/b.foo210$abs_path/one/two/c.foo211$abs_path/one/two/C.Foo2212$abs_path/one/two/three/d.foo213$abs_path/one/two/three/directory_foo" foo "$abs_path"214215216if [[ "$OSTYPE" == "linux-gnu" ]]; then215suite "Invalid UTF-8"216touch "$(printf 'test-invalid-utf8-\xc3.txt')"217expect "$(printf 'test-invalid-utf8-\ufffd.txt')" test-invalid-utf8217 suite "Invalid UTF-8"218 touch "$(printf 'test-invalid-utf8-\xc3.txt')"219 expect "$(printf 'test-invalid-utf8-\ufffd.txt')" test-invalid-utf8220fi221222# All done223echo