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
Provenance
- Commit
d8d0cf5- Tree
178b1e4- Author
sharkdp <davidpeter@web.de>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
eb72875
1 file changed+40 added−37 removed
modified:tests/test.sh+40 added-37 removed
26 unmodified lines27 tmp_output="$(mktemp -t "$MKTEMP_TEMPLATE")"28 29 echo "$expected_output" > "$tmp_expected"30 31- "$fd" "$@" | sort > "$tmp_output"31+ "$fd" "$@" | sort -f > "$tmp_output"32 33 echo -ne " ${bold}▶${reset} Testing 'fd $*' ... "34 35 if diff -q "$tmp_expected" "$tmp_output" > /dev/null; then5 unmodified lines41 42 echo -ne "\nShowing diff between ${red}expected${reset} and "43 echo -e "${green}actual${reset} output:\n"44 45- diff -C3 --label expected --label actual --color \45+ diff -C3 --label expected --label actual \46 "$tmp_expected" "$tmp_output" || true47 48 rm -f "$tmp_expected" "$tmp_output"49 11 unmodified lines61 62 touch a.foo63 touch one/b.foo64 touch one/two/c.foo65-touch one/two/C.Foo65+touch one/two/C.Foo266 touch one/two/three/d.foo67 mkdir one/two/three/directory_foo68 touch ignored.foo69 touch .hidden.foo10 unmodified lines80 expect "one/two/three/d.foo" d.foo81 expect "a.foo82 one/b.foo83 one/two/c.foo84-one/two/C.Foo84+one/two/C.Foo285 one/two/three/d.foo86 one/two/three/directory_foo" foo87 expect "a.foo88 one89 one/b.foo90 one/two91 one/two/c.foo92-one/two/C.Foo92+one/two/C.Foo293 one/two/three94 one/two/three/d.foo95 one/two/three/directory_foo96 symlink" # run 'fd' without arguments97 98 suite "Explicit root path"99 expect "one/b.foo100 one/two/c.foo101-one/two/C.Foo101+one/two/C.Foo2102 one/two/three/d.foo103 one/two/three/directory_foo" foo one104 expect "one/two/three/d.foo105 one/two/three/directory_foo" foo one/two/three1 unmodified line107 cd one/two108 expect "../../a.foo109 ../b.foo110 c.foo111-C.Foo111+C.Foo2112 three/d.foo113 three/directory_foo" foo ../../114 )115 116 suite "Regex searches"117 expect "a.foo118 one/b.foo119 one/two/c.foo120-one/two/C.Foo" '[a-c].foo'120+one/two/C.Foo2" '[a-c].foo'121 expect "a.foo122 one/b.foo123 one/two/c.foo" --case-sensitive '[a-c].foo'124 125 126 127 suite "Smart case"128 expect "one/two/c.foo129-one/two/C.Foo" c.foo130-expect "one/two/C.Foo" C.Foo131-expect "one/two/C.Foo" Foo129+one/two/C.Foo2" c.foo130+expect "one/two/C.Foo2" C.Foo131+expect "one/two/C.Foo2" Foo132 133 134 suite "Case-sensitivity (--case-sensitive)"135 expect "one/two/c.foo" --case-sensitive c.foo136-expect "one/two/C.Foo" --case-sensitive C.Foo136+expect "one/two/C.Foo2" --case-sensitive C.Foo137 138 139 suite "Full path search (--full-path)"140 expect "one/two/three/d.foo1 unmodified line142 expect "a.foo" --full-path '^a\.foo$'143 144 145 suite "Hidden files (--hidden)"146-expect "a.foo147-.hidden.foo146+expect ".hidden.foo147+a.foo148 one/b.foo149 one/two/c.foo150-one/two/C.Foo150+one/two/C.Foo2151 one/two/three/d.foo152 one/two/three/directory_foo" --hidden foo153 154 1 unmodified line156 expect "a.foo157 ignored.foo158 one/b.foo159 one/two/c.foo160-one/two/C.Foo160+one/two/C.Foo2161 one/two/three/d.foo162 one/two/three/directory_foo" --no-ignore foo163 164-expect "a.foo165-.hidden.foo164+expect ".hidden.foo165+a.foo166 ignored.foo167 one/b.foo168 one/two/c.foo169-one/two/C.Foo169+one/two/C.Foo2170 one/two/three/d.foo171 one/two/three/directory_foo" --hidden --no-ignore foo172 173 174 suite "Symlinks (--follow)"175 expect "one/two/c.foo176-one/two/C.Foo176+one/two/C.Foo2177 symlink/c.foo178-symlink/C.Foo" --follow c.foo178+symlink/C.Foo2" --follow c.foo179 180 181 suite "Maximum depth (--max-depth)"182 expect "a.foo183 one184 one/b.foo185 one/two186 one/two/c.foo187-one/two/C.Foo187+one/two/C.Foo2188 one/two/three189 symlink" --max-depth 3190 expect "a.foo191 one3 unmodified lines195 expect "a.foo196 one197 symlink" --max-depth 1198 199+abs_path=$(python -c "import os; print(os.path.realpath('$root'))")200 201 suite "Absolute paths (--absolute-path)"201-expect "$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 foo207-expect "$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"202+expect "$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 foo208+expect "$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"214 215 216+if [[ "$OSTYPE" == "linux-gnu" ]]; then215-suite "Invalid UTF-8"216-touch "$(printf 'test-invalid-utf8-\xc3.txt')"217-expect "$(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-utf8220+fi221 222 # All done223 echo