Skip to content

Commit bcd39fc

Browse files
authored
Fix diff command to only set --strip-trailing-cr if available (#152)
1 parent 4418961 commit bcd39fc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

contrib/tests/shpproj.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,19 @@ readonly SCRIPTDIR=$(dirname "$0")
2121

2222
"${SHPDUMP:-$top_builddir/shpdump}" -precision 8 "test" > "test.out"
2323

24-
25-
if result=$(diff --strip-trailing-cr "$SCRIPTDIR/expect.out" "test.out"); then
24+
supports_strip_trailing_cr() {
25+
diff --help 2>/dev/null | grep -q -- '--strip-trailing-cr'
26+
}
27+
28+
run_diff() {
29+
if supports_strip_trailing_cr; then
30+
diff --strip-trailing-cr "$SCRIPTDIR/expect.out" "test.out"
31+
else
32+
diff "$SCRIPTDIR/expect.out" "test.out"
33+
fi
34+
}
35+
36+
if result=$(run_diff); then
2637
echo "******* Test Succeeded *********"
2738
exit 0
2839
else

0 commit comments

Comments
 (0)