mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Support reporting diffs even when colordiff is not present.
The Travis macOS test systems do not appear to have colordiff present, so any failures would mean that no output would be shown. This may also be a problem for the other test scripts as well, but the invocation tests are the ones being affected here. We change our behaviour to downgrade to the plain diff tool if colordiff is not present.
This commit is contained in:
parent
b48cfbefba
commit
8d83c967d3
1 changed files with 11 additions and 2 deletions
|
@ -84,6 +84,15 @@ term_white="$(tput setaf 7)"
|
|||
term_reset="$(tput sgr0)"
|
||||
|
||||
|
||||
# Check whether we have the 'colordiff' tool - if not, we'll revert to
|
||||
# boring regular 'diff'.
|
||||
if [ "$(type -t colordiff)" != '' ] ; then
|
||||
difftool='colordiff'
|
||||
else
|
||||
difftool='diff'
|
||||
fi
|
||||
|
||||
|
||||
##
|
||||
# Set variables to known values so that they will not affect the
|
||||
# execution of the test.
|
||||
|
@ -237,11 +246,11 @@ function test_file() {
|
|||
|
||||
if [ "$out_status" != '0' ] ; then
|
||||
say yellow "Output differs for file $file. Diff follows:"
|
||||
colordiff -u "${test_stdout}" "${want_stdout}"
|
||||
"$difftool" -u "${test_stdout}" "${want_stdout}"
|
||||
fi
|
||||
if [ "$err_status" != '0' ] ; then
|
||||
say yellow "Error output differs for file $file. Diff follows:"
|
||||
colordiff -u "${test_stderr}" "${want_stderr}"
|
||||
"$difftool" -u "${test_stderr}" "${want_stderr}"
|
||||
fi
|
||||
rc=1
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue