1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-28 00:39:31 +08:00

Merge pull request #1599 from ipfs/binary-data-and-json

Binary data and json test
This commit is contained in:
Juan Benet
2015-08-25 16:18:31 +02:00
2 changed files with 21 additions and 1 deletions

Binary file not shown.

View File

@ -111,6 +111,26 @@ test_object_cmd() {
test_cmp expected_putBrokenErr actual_putBrokenErr test_cmp expected_putBrokenErr actual_putBrokenErr
' '
test_expect_success "setup: add UTF-8 test file" '
HASH="QmNY5sQeH9ttVCg24sizH71dNbcZTpGd7Yb3YwsKZ4jiFP" &&
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" ' test_expect_success "'ipfs object patch' should work" '
EMPTY_DIR=$(ipfs object new unixfs-dir) && EMPTY_DIR=$(ipfs object new unixfs-dir) &&
OUTPUT=$(ipfs object patch $EMPTY_DIR add-link foo $EMPTY_DIR) OUTPUT=$(ipfs object patch $EMPTY_DIR add-link foo $EMPTY_DIR)