Skip to content

Commit

Permalink
t0051: check json i/o
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
  • Loading branch information
chriscool committed Aug 24, 2015
1 parent e4a0a3b commit fee46fb
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/sharness/t0051-object.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ test_object_cmd() {
echo "CumulativeSize: 18" >> expected_stat &&
test_cmp expected_stat actual_stat
'

test_expect_success "'ipfs object put file.json' succeeds" '
ipfs object put ../t0051-object-data/testPut.json > actual_putOut
'
Expand Down Expand Up @@ -111,6 +111,26 @@ test_object_cmd() {
test_cmp expected_putBrokenErr actual_putBrokenErr
'

test_expect_success "setup: add UTF-8 test file" '
HASH="QmVDcJvu7CiqeUeHhnkvej9UZu6PMDXxED5r2nuuzn2G7M" &&
ipfs add ../t0051-object-data/UTF-8-test.txt >actual &&
echo "added $HASH UTF-8-test.txt" >expected &&
test_cmp expected actual
'

test_expect_success "'ipfs object get --enc=json' succeeds" '
ipfs object get --enc=json $HASH >utf8_json
'

test_expect_success "'ipfs object put --inputenc=json' succeeds" '
ipfs object put --inputenc=json <utf8_json >actual
'

test_expect_failure "'ipfs object put --inputenc=json' output looks good" '
echo "added $HASH" >expected &&
test_cmp expected actual
'

test_expect_success "'ipfs object patch' should work" '
EMPTY_DIR=$(ipfs object new unixfs-dir) &&
OUTPUT=$(ipfs object patch $EMPTY_DIR add-link foo $EMPTY_DIR)
Expand Down

0 comments on commit fee46fb

Please sign in to comment.