github.com/zignig/go-ipfs@v0.0.0-20141111235910-c9e5fdf55a52/test/t0050-block.sh (about) 1 #!/bin/sh 2 # 3 # Copyright (c) 2014 Christian Couder 4 # MIT Licensed; see the LICENSE file in this repository. 5 # 6 7 test_description="Test block command" 8 9 . lib/test-lib.sh 10 11 test_expect_success "ipfs init succeeds" ' 12 export IPFS_DIR="$(pwd)/.go-ipfs" && 13 ipfs init 14 ' 15 16 test_expect_success "'ipfs block put' succeeds" ' 17 echo "Hello Mars!" >expected_in && 18 ipfs block put <expected_in >actual_out 19 ' 20 21 test_expect_success "'ipfs block put' output looks good" ' 22 HASH="QmRKqGMAM6EZngbpjSqrvYzq5Qd8b1bSWymjSUY9zQSNDk" && 23 echo "added as '\''$HASH'\''" >expected_out && 24 test_cmp expected_out actual_out 25 ' 26 27 test_expect_success "'ipfs block get' succeeds" ' 28 ipfs block get $HASH >actual_in 29 ' 30 31 test_expect_success "'ipfs block get' output looks good" ' 32 test_cmp expected_in actual_in 33 ' 34 35 test_done