tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_diffoscope (1189B)


      1 #!/bin/bash
      2 
      3 set -e
      4 
      5 WORKDIR=$(mktemp -d)
      6 cd $WORKDIR
      7 
      8 mkdir -p a/foo/bar/bar
      9 mkdir -p a/foo/bar/baz
     10 mkdir -p b/foo/bar/bar
     11 mkdir -p b/foo/bar/baz
     12 
     13 # A file that is modified
     14 echo qux > a/foo/bar/qux
     15 echo quz > b/foo/bar/qux
     16 
     17 # A binary file that is modified
     18 cp $(which ls) a/foo/bin
     19 cp $(which cat) b/foo/bin
     20 
     21 # A file that is removed
     22 echo hoge > a/foo/bar/bar/hoge
     23 
     24 # A file that is created
     25 echo fuga > b/foo/bar/baz/fuga
     26 
     27 # Also add a zip file with the same contents
     28 (cd a/foo; zip -r bar.zip bar)
     29 (cd b/foo; zip -r bar.zip bar)
     30 
     31 if TERM=linux diffoscope --no-progress --text diff.txt a b; then
     32 	echo "diffoscope didn't find differences?"
     33 	exit 1
     34 fi
     35 
     36 cat > expected.txt <<EOF
     37 TEST-UNEXPECTED-FAIL | foo/bar.zip differs. See the diff.html or diff.txt artifact
     38 TEST-UNEXPECTED-FAIL | foo/bar/bar differs. See the diff.html or diff.txt artifact
     39 TEST-UNEXPECTED-FAIL | foo/bar/baz differs. See the diff.html or diff.txt artifact
     40 TEST-UNEXPECTED-FAIL | foo/bar/qux differs. See the diff.html or diff.txt artifact
     41 TEST-UNEXPECTED-FAIL | foo/bin differs. See the diff.html or diff.txt artifact
     42 EOF
     43 
     44 $(dirname $0)/report_error diff | diff -u - expected.txt || exit 1
     45 
     46 cd $OLDPWD
     47 rm -rf $WORKDIR