Skip to content

Commit

Permalink
Merge branch 't0030-mount' of https://github.com/kkoroviev/go-ipfs in…
Browse files Browse the repository at this point in the history
…to kkoroviev-t0030-mount
  • Loading branch information
jbenet committed Mar 23, 2015
2 parents 8a1783b + da93e15 commit 4fbb0b4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
19 changes: 19 additions & 0 deletions test/sharness/lib/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,22 @@ test_curl_resp_http_code() {
cat curl_output
return 1
}

test_must_be_empty() {
if test -s "$1"
then
echo "'$1' is not empty, it contains:"
cat "$1"
return 1
fi
}

test_should_contain() {
test "$#" = 2 || error "bug in the test script: not 2 parameters to test_should_contain"
if ! grep -q "$1" "$2"
then
echo "'$2' does not contain '$1', it contains:"
cat "$2"
return 1
fi
}
12 changes: 4 additions & 8 deletions test/sharness/t0030-mount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ test_launch_ipfs_daemon

# run this mount failure before mounting properly.

test_expect_failure "'ipfs mount' fails when no mount dir (issue #341)" '
test_must_fail ipfs mount -f=not_ipfs -n=not_ipns >actual
'

test_expect_failure "'ipfs mount' looks good when it fails (issue #341)" '
! grep "IPFS mounted at: $(pwd)/ipfs" actual >/dev/null &&
! grep "IPNS mounted at: $(pwd)/ipns" actual >/dev/null ||
test_fsh cat actual
test_expect_success "'ipfs mount' fails when no mount dir (issue #341)" '
test_must_fail eval "ipfs mount -f=not_ipfs -n=not_ipns >output 2>output.err" &&
test_must_be_empty output &&
test_should_contain "not_ipns\|not_ipfs" output.err
'

# now mount properly, and keep going
Expand Down

0 comments on commit 4fbb0b4

Please sign in to comment.