kubo/test/ipfs-test-lib.sh
Christian Couder 65cbbdff84 Add ipfs-test-lib.sh and source it in sharness test-lib.sh
The new ipfs-test-lib.sh file contains generic test
functions.
We also start replacing fsh with a shell function named
test_fsh() in ipfs-test-lib.sh.
And we move our custom test_cmp in ipfs-test-lib.sh.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-02-04 21:50:07 +01:00

19 lines
410 B
Bash

# Generic test functions for go-ipfs
# Echo the args, run the cmd, and then also fail,
# making sure a test case fails.
test_fsh() {
echo "> $@"
eval "$@"
echo ""
false
}
# Same as sharness' test_cmp but using test_fsh (to see the output).
# We have to do it twice, so the first diff output doesn't show unless it's
# broken.
test_cmp() {
diff -q "$@" >/dev/null || test_fsh diff -u "$@"
}