From 51d05fb8dce45dbd3b7b9cf16ee3840661b793f0 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 15 Oct 2015 20:43:27 +0200 Subject: [PATCH 1/2] t0010: test 'ipfs commands' and 'ipfs * --help' License: MIT Signed-off-by: Christian Couder --- test/sharness/t0010-basic-commands.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/sharness/t0010-basic-commands.sh b/test/sharness/t0010-basic-commands.sh index 9cf306a5d..65f2ca078 100755 --- a/test/sharness/t0010-basic-commands.sh +++ b/test/sharness/t0010-basic-commands.sh @@ -31,4 +31,22 @@ test_expect_success "ipfs help output looks good" ' test_fsh cat help.txt ' +test_expect_success "'ipfs commands' succeeds" ' + ipfs commands >commands.txt +' + +test_expect_success "'ipfs commands' output looks good" ' + grep "ipfs add" commands.txt && + grep "ipfs daemon" commands.txt && + grep "ipfs update" commands.txt +' + +test_expect_success "All commands accept --help" ' + while read -r cmd + do + echo "running: $cmd --help" + $cmd --help /dev/null || return + done Date: Thu, 15 Oct 2015 21:43:15 +0200 Subject: [PATCH 2/2] t00{1,6}0: remove some useless cats License: MIT Signed-off-by: Christian Couder --- test/sharness/t0010-basic-commands.sh | 6 +++--- test/sharness/t0060-daemon.sh | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/sharness/t0010-basic-commands.sh b/test/sharness/t0010-basic-commands.sh index 65f2ca078..2b8e8dd80 100755 --- a/test/sharness/t0010-basic-commands.sh +++ b/test/sharness/t0010-basic-commands.sh @@ -17,7 +17,7 @@ test_expect_success "ipfs version succeeds" ' ' test_expect_success "ipfs version output looks good" ' - cat version.txt | egrep "^ipfs version [0-9]+\.[0-9]+\.[0-9]" >/dev/null || + egrep "^ipfs version [0-9]+\.[0-9]+\.[0-9]" version.txt >/dev/null || test_fsh cat version.txt ' @@ -26,8 +26,8 @@ test_expect_success "ipfs help succeeds" ' ' test_expect_success "ipfs help output looks good" ' - cat help.txt | egrep -i "^Usage:" >/dev/null && - cat help.txt | egrep "ipfs .* " >/dev/null || + egrep -i "^Usage:" help.txt >/dev/null && + egrep "ipfs .* " help.txt >/dev/null || test_fsh cat help.txt ' diff --git a/test/sharness/t0060-daemon.sh b/test/sharness/t0060-daemon.sh index 44bb87515..9d0bce03c 100755 --- a/test/sharness/t0060-daemon.sh +++ b/test/sharness/t0060-daemon.sh @@ -60,7 +60,7 @@ test_expect_success "ipfs daemon output looks good" ' echo "peer identity: $PEERID" >>expected_daemon && echo "to get started, enter:" >>expected_daemon && printf "\\n\\t$STARTFILE\\n\\n" >>expected_daemon && - cat local_addrs | sed "s/^/Swarm listening on /" >>expected_daemon && + sed "s/^/Swarm listening on /" local_addrs >>expected_daemon && echo "API server listening on /ip4/127.0.0.1/tcp/5001" >>expected_daemon && echo "Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080" >>expected_daemon && echo "Daemon is ready" >>expected_daemon && @@ -82,7 +82,7 @@ test_expect_success "ipfs version succeeds" ' ' test_expect_success "ipfs version output looks good" ' - cat version.txt | egrep "^ipfs version [0-9]+\.[0-9]+\.[0-9]" >/dev/null || + egrep "^ipfs version [0-9]+\.[0-9]+\.[0-9]" version.txt >/dev/null || test_fsh cat version.txt ' @@ -91,8 +91,8 @@ test_expect_success "ipfs help succeeds" ' ' test_expect_success "ipfs help output looks good" ' - cat help.txt | egrep -i "^Usage:" >/dev/null && - cat help.txt | egrep "ipfs .* " >/dev/null || + egrep -i "^Usage:" help.txt >/dev/null && + egrep "ipfs .* " help.txt >/dev/null || test_fsh cat help.txt '