github.com/keltia/go-ipfs@v0.3.8-0.20150909044612-210793031c63/test/ipfs-test-lib.sh (about) 1 # Generic test functions for go-ipfs 2 3 # Echo the args, run the cmd, and then also fail, 4 # making sure a test case fails. 5 test_fsh() { 6 echo "> $@" 7 eval "$@" 8 echo "" 9 false 10 } 11 12 # Same as sharness' test_cmp but using test_fsh (to see the output). 13 # We have to do it twice, so the first diff output doesn't show unless it's 14 # broken. 15 test_cmp() { 16 diff -q "$@" >/dev/null || test_fsh diff -u "$@" 17 } 18 19 # Same as test_cmp above, but we sort files before comparing them. 20 test_sort_cmp() { 21 sort "$1" >"$1_sorted" && 22 sort "$2" >"$2_sorted" && 23 test_cmp "$1_sorted" "$2_sorted" 24 }