1#!/bin/bash 2 3#testing "name" "command" "result" "infile" "stdin" 4 5seq 10 > left 6seq 11 > right 7 8testing "unknown argument" 'diff --oops left right 2>/dev/null ; echo $?' "2\n" "" "" 9testing "missing" 'diff missing1 missing2 2>/dev/null ; echo $?' "2\n" "" "" 10 11testing "- -" 'diff - - ; echo $?' "0\n" "" "whatever" 12 13expected='--- lll 14+++ rrr 15@@ -8,3 +8,4 @@ 16 8 17 9 18 10 19+11 20' 21# Hm this only gives unified diffs? 22testing "simple" "diff -L lll -L rrr left right" "$expected" "" "" 23 24 25expected='--- tree1/file 26+++ tree2/file 27@@ -1 +1 @@ 28-foo 29+food 30' 31mkdir -p tree1 tree2 32echo foo > tree1/file 33echo food > tree2/file 34 35testing "-r" "diff -r -L tree1/file -L tree2/file tree1 tree2 |tee out" "$expected" "" "" 36 37echo -e "hello\r\nworld\r\n"> a 38echo -e "hello\nworld\n"> b 39testing "--strip-trailing-cr off" "diff -q a b" "Files a and b differ\n" "" "" 40testing "--strip-trailing-cr on" "diff -u --strip-trailing-cr a b" "" "" "" 41