Skip to content
Myr

Update test.sh script, see #44

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

authored by sharkdp · committed by sharkdp · parent dfd7433 · Browse files · 1 file+10 added−3 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+10 added−3 removed

  • tests:+10 added−3 removed

1 file+10 added−3 removed

modified:tests/test.sh+10 added-3 removed
2 unmodified lines
3SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"45fd="${SCRIPT_DIR}/../target/debug/fd"67MKTEMP_TEMPLATE="fd-tests.XXXXXXXXXX"89export reset='\x1b[0m'10export bold='\x1b[01m'11export green='\x1b[32;01m'12export red='\x1b[31;01m'
9 unmodified lines
22expect() {23 expected_output="$1"24 shift2524 tmp_expected="$(mktemp)"25 tmp_output="$(mktemp)"26 tmp_expected="$(mktemp -t "$MKTEMP_TEMPLATE")"27 tmp_output="$(mktemp -t "$MKTEMP_TEMPLATE")"2829 echo "$expected_output" > "$tmp_expected"3031 "$fd" "$@" | sort > "$tmp_output"
1 unmodified line
33 echo -ne " ${bold}▶${reset} Testing 'fd $*' ... "3435 if diff -q "$tmp_expected" "$tmp_output" > /dev/null; then36 echo -e "${green}✓ okay${reset}"3738 rm -f "$tmp_expected" "$tmp_output"39 else40 echo -e "${red}❌FAILED${reset}"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 \46 "$tmp_expected" "$tmp_output" || true4748 rm -f "$tmp_expected" "$tmp_output"4950 exit 151 fi52}5347root=$(mktemp --directory)54root=$(mktemp -d -t "$MKTEMP_TEMPLATE")5556cd "$root"5758# Setup test environment
162 unmodified lines