From c9b95f4b5e22457d978e855025b4d3807ca4f854 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 30 Jun 2022 03:40:41 -0500 Subject: [PATCH] Make diff tests pass with TEST_HOST. --- tests/diff.test | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/diff.test b/tests/diff.test index 5903f144..4edaa232 100644 --- a/tests/diff.test +++ b/tests/diff.test @@ -5,34 +5,32 @@ seq 10 > left seq 11 > right -testing "unknown argument" 'diff --oops left right 2>/dev/null ; echo $?' "2\n" "" "" -testing "missing" 'diff missing1 missing2 2>/dev/null ; echo $?' "2\n" "" "" +testcmd "unknown argument" '--oops left right 2>/dev/null ; echo $?' "2\n" "" "" +testcmd "missing" 'missing1 missing2 2>/dev/null ; echo $?' "2\n" "" "" testing "- -" 'diff - - ; echo $?' "0\n" "" "whatever" -expected='--- lll +testing "simple" "diff -u -L lll -L rrr left right" '--- lll +++ rrr @@ -8,3 +8,4 @@ 8 9 10 +11 -' -# Hm this only gives unified diffs? -testing "simple" "diff -L lll -L rrr left right" "$expected" "" "" +' "" "" +mkdir -p tree1 tree2 +echo foo > tree1/file +echo food > tree2/file -expected='--- tree1/file +# Debian's diff gratuitously echoes its command line with -r. No idea why. +testcmd "-r" "-u -r -L tree1/file -L tree2/file tree1 tree2 | grep -v ^diff" \ + '--- tree1/file +++ tree2/file @@ -1 +1 @@ -foo +food -' -mkdir -p tree1 tree2 -echo foo > tree1/file -echo food > tree2/file - -testing "-r" "diff -r -L tree1/file -L tree2/file tree1 tree2 |tee out" "$expected" "" "" +' "" "" echo -e "hello\r\nworld\r\n"> a echo -e "hello\nworld\n"> b @@ -55,4 +53,4 @@ expected='--- fifo1 -2 +3 ' -testing "fifos" "diff -L fifo1 -L fifo2 fifo1 fifo2" "$expected" "" "" +testing "fifos" "diff -u -L fifo1 -L fifo2 fifo1 fifo2" "$expected" "" "" -- 2.39.2