@cryptotaxi247 / kubo / commits / 7d80512a4

test-lib: add test_path_cmp()

License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Feb 12, 2016 at 08:13 UTC 7d80512a4c9f0ccd232607436b5c1f9ab29c6d84
2 files changed +9 -1
test/ipfs-test-lib.sh
+8
@@ -23,6 +23,14 @@ test_sort_cmp() {
23 test_cmp "$1_sorted" "$2_sorted"
24 }
25
26 +# Same as test_cmp above, but we standardize directory
27 +# separators before comparing the files.
28 +test_path_cmp() {
29 + sed -e "s/\\\\/\//g" "$1" >"$1_std" &&
30 + sed -e "s/\\\\/\//g" "$2" >"$2_std" &&
31 + test_cmp "$1_std" "$2_std"
32 +}
33 +
34 # Quote arguments for sh eval
35 shellquote() {
36 _space=''
test/sharness/t0020-init.sh
+1 -1
@@ -39,7 +39,7 @@ test_expect_success "ipfs cat fails" '
39 test_expect_success "ipfs cat no repo message looks good" '
40 echo "Error: no ipfs repo found in $IPFS_PATH." > cat_fail_exp &&
41 echo "please run: ipfs init" >> cat_fail_exp &&
42 - test_cmp cat_fail_exp cat_fail_out
42 + test_path_cmp cat_fail_exp cat_fail_out
43 '
44
45 # test that init succeeds