From 0b3d34b6c3b946520481c0ef7009b15951216e38 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Mon, 3 Oct 2016 09:41:53 +0200 Subject: [PATCH 1/2] t0010: add failing tests --- test/sharness/t0010-basic-commands.sh | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/test/sharness/t0010-basic-commands.sh b/test/sharness/t0010-basic-commands.sh index 33d3ea8de2..7f33aaaa4e 100755 --- a/test/sharness/t0010-basic-commands.sh +++ b/test/sharness/t0010-basic-commands.sh @@ -26,4 +26,50 @@ test_expect_success "ipfs version output looks good" ' test_fsh cat version.txt ' +test_expect_success "ipfs version --all has all required fields" ' + ipfs version --all > version_all.txt && + grep "go-ipfs version" version_all.txt && + grep "Repo version" version_all.txt && + grep "System version" version_all.txt && + grep "Golang version" version_all.txt +' + +test_expect_success "ipfs help succeeds" ' + ipfs help >help.txt +' + +test_expect_success "ipfs help output looks good" ' + egrep -i "^Usage" help.txt >/dev/null && + egrep "ipfs .* " help.txt >/dev/null || + 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 commands.txt +' + +test_expect_success "'ipfs commands --flags' output looks good" ' + grep "ipfs pin add --recursive / ipfs pin add -r" commands.txt && + grep "ipfs id --format / ipfs id -f" commands.txt && + grep "ipfs repo gc --quiet / ipfs repo gc -q" commands.txt +' + test_done From 87782ea28012e0db651a0df27c4ce7192d9951d7 Mon Sep 17 00:00:00 2001 From: David Dias Date: Mon, 13 Feb 2017 13:19:40 -0800 Subject: [PATCH 2/2] sharness --- test/sharness/t0010-basic-commands.sh | 61 +++++++++++++-------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/test/sharness/t0010-basic-commands.sh b/test/sharness/t0010-basic-commands.sh index 7f33aaaa4e..03aadc83f5 100755 --- a/test/sharness/t0010-basic-commands.sh +++ b/test/sharness/t0010-basic-commands.sh @@ -9,15 +9,15 @@ test_description="Test installation and some basic commands" . lib/test-lib.sh test_expect_success "current dir is writable" ' - echo "It works!" >test.txt + echo "It works!" > test.txt ' test_expect_success "ipfs version succeeds" ' - ipfs version >version.txt + ipfs version > version.txt ' test_expect_success "ipfs version shows js-ipfs" ' - grep "js-ipfs" version.txt >/dev/null || + grep "js-ipfs" version.txt > /dev/null || test_fsh cat version.txt ' @@ -28,48 +28,45 @@ test_expect_success "ipfs version output looks good" ' test_expect_success "ipfs version --all has all required fields" ' ipfs version --all > version_all.txt && - grep "go-ipfs version" version_all.txt && - grep "Repo version" version_all.txt && - grep "System version" version_all.txt && - grep "Golang version" version_all.txt + grep "js-ipfs version" version_all.txt ' test_expect_success "ipfs help succeeds" ' - ipfs help >help.txt + ipfs help > help.txt ' -test_expect_success "ipfs help output looks good" ' - egrep -i "^Usage" help.txt >/dev/null && - egrep "ipfs .* " help.txt >/dev/null || - test_fsh cat help.txt -' +# test_expect_success "ipfs help output looks good" ' +# egrep -i "^Usage" help.txt > /dev/null && +# egrep "ipfs .* " help.txt >/dev/null || +# test_fsh cat help.txt +# ' test_expect_success "'ipfs commands' succeeds" ' - ipfs commands >commands.txt + 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 + grep "add" commands.txt && + grep "daemon" commands.txt && + grep "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 /dev/null || return +# done commands.txt -' +# test_expect_success "'ipfs commands --flags' succeeds" ' +# ipfs commands --flags >commands.txt +# ' -test_expect_success "'ipfs commands --flags' output looks good" ' - grep "ipfs pin add --recursive / ipfs pin add -r" commands.txt && - grep "ipfs id --format / ipfs id -f" commands.txt && - grep "ipfs repo gc --quiet / ipfs repo gc -q" commands.txt -' +# test_expect_success "'ipfs commands --flags' output looks good" ' +# grep "ipfs pin add --recursive / ipfs pin add -r" commands.txt && +# grep "ipfs id --format / ipfs id -f" commands.txt && +# grep "ipfs repo gc --quiet / ipfs repo gc -q" commands.txt +# ' test_done