Skip to content

Commit f675f3c

Browse files
committed
sharness: have 'object put/get' data in seperate files
1 parent 3dc26c9 commit f675f3c

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"Links": [],
3+
"Data": "\u0008\u0002\u0012\nHello Mars\u0018\n"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"Data": "test json for sharness test"
3+
}

test/sharness/t0051-object.sh

+3-16
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ test_expect_success "'ipfs object get' succeeds" '
2626
'
2727

2828
test_expect_success "'ipfs object get' output looks good" '
29-
echo "{" > expected_getOut &&
30-
echo " \"Links\": []," >> expected_getOut &&
31-
echo " \"Data\": \"\u0008\u0002\u0012\nHello Mars\u0018\n\"" >> expected_getOut &&
32-
echo -n "}" >> expected_getOut &&
33-
test_cmp expected_getOut actual_getOut
29+
test_cmp ../t0051-object-data/expected_getOut actual_getOut
3430
'
3531

3632
test_expect_success "'ipfs object stat' succeeds" '
@@ -46,17 +42,8 @@ echo "CumulativeSize: 18" >> expected_stat &&
4642
test_cmp expected_stat actual_stat
4743
'
4844

49-
# semicool way to get json inline without much escaping
50-
objectPutJson=$(cat << EOF
51-
{
52-
"Data": "test json for sharness test"
53-
}
54-
EOF
55-
)
56-
5745
test_expect_success "'ipfs object put file.json' succeeds" '
58-
echo $objectPutJson > file.json &&
59-
ipfs object put file.json > actual_putOut
46+
ipfs object put ../t0051-object-data/testPut.json > actual_putOut
6047
'
6148

6249
test_expect_success "'ipfs object put file.json' output looks good" '
@@ -66,7 +53,7 @@ test_expect_success "'ipfs object put file.json' output looks good" '
6653
'
6754

6855
test_expect_success "'ipfs object put' from stdin succeeds" '
69-
echo $objectPutJson | ipfs object put > actual_putStdinOut
56+
cat ../t0051-object-data/testPut.json | ipfs object put > actual_putStdinOut
7057
'
7158

7259
test_expect_success "'ipfs object put' from stdin output looks good" '

0 commit comments

Comments
 (0)