test/sharness: make sure to output vars in quotes
cc @whyrusleeping: you werent doing so cc @mappum: you were trying to escape them, but were un-escaping them in cases with longer quotes.
Juan Batiz-Benet committed
Jan 28, 2015 at 01:04 UTC
cbe07776e32240b031d3513aee7d9801c5447318
2 files changed
+26
-26
test/sharness/t0080-repo.sh
+22
-22
@@ -18,7 +18,7 @@ test_expect_success "'ipfs add afile' succeeds" '
18
'
19
20
test_expect_success "added file was pinned" '
21
- ipfs pin ls -type=recursive | grep $HASH
21
+ ipfs pin ls -type=recursive | grep "$HASH"
22
'
23
24
test_expect_success "'ipfs repo gc' succeeds" '
@@ -31,13 +31,13 @@ test_expect_success "'ipfs repo gc' looks good (empty)" '
31
'
32
33
test_expect_success "'ipfs repo gc' doesnt remove file" '
34
- ipfs cat $HASH >out
34
+ ipfs cat "$HASH" >out
35
test_cmp out afile
36
'
37
38
test_expect_success "'ipfs pin rm' succeeds" '
39
- echo unpinned $HASH >expected1
40
- ipfs pin rm -r $HASH >actual1
39
+ echo "unpinned $HASH" >expected1
40
+ ipfs pin rm -r "$HASH" >actual1
41
test_cmp expected1 actual1
42
'
43
@@ -49,36 +49,36 @@ test_expect_success "file no longer pinned" '
49
'
50
51
test_expect_success "recursively pin afile" '
52
- ipfs pin add -r $HASH
52
+ ipfs pin add -r "$HASH"
53
'
54
55
test_expect_success "pinning directly should fail now" '
56
- echo Error: pin: $HASH already pinned recursively >expected3
57
- ipfs pin add $HASH 2>actual3
56
+ echo "Error: pin: $HASH already pinned recursively" >expected3
57
+ ipfs pin add "$HASH" 2>actual3
58
test_cmp expected3 actual3
59
'
60
61
test_expect_success "'ipfs pin rm <hash>' should fail" '
62
- echo Error: $HASH is pinned recursively >expected4
63
- ipfs pin rm $HASH 2>actual4
62
+ echo "Error: $HASH is pinned recursively" >expected4
63
+ ipfs pin rm "$HASH" 2>actual4
64
test_cmp expected4 actual4
65
'
66
67
test_expect_success "remove recursive pin, add direct" '
68
- echo unpinned $HASH >expected5
69
- ipfs pin rm -r $HASH >actual5
68
+ echo "unpinned $HASH" >expected5
69
+ ipfs pin rm -r "$HASH" >actual5
70
test_cmp expected5 actual5
71
- ipfs pin add $HASH
71
+ ipfs pin add "$HASH"
72
'
73
74
test_expect_success "remove direct pin" '
75
- echo unpinned $HASH >expected6
76
- ipfs pin rm $HASH >actual6
75
+ echo "unpinned $HASH" >expected6
76
+ ipfs pin rm "$HASH" >actual6
77
test_cmp expected6 actual6
78
'
79
80
test_expect_success "'ipfs repo gc' removes file" '
81
- echo removed $HASH >expected7
81
+ echo "removed $HASH" >expected7
82
ipfs repo gc >actual7
83
test_cmp expected7 actual7
84
'
@@ -96,7 +96,7 @@ test_expect_success "adding multiblock random file succeeds" '
96
'
97
98
test_expect_success "'ipfs pin ls -type=indirect' is correct" '
99
- ipfs refs $MBLOCKHASH | sort >refsout
99
+ ipfs refs "$MBLOCKHASH" | sort >refsout
100
ipfs pin ls -type=indirect | sort >indirectpins
101
test_cmp refsout indirectpins
102
'
@@ -104,17 +104,17 @@ test_expect_success "'ipfs pin ls -type=indirect' is correct" '
104
test_expect_success "pin something directly" '
105
echo "ipfs is so awesome" >awesome
106
DIRECTPIN=`ipfs add -q awesome`
107
- echo unpinned $DIRECTPIN >expected9
108
- ipfs pin rm -r $DIRECTPIN >actual9
107
+ echo "unpinned $DIRECTPIN" >expected9
108
+ ipfs pin rm -r "$DIRECTPIN" >actual9
109
test_cmp expected9 actual9
110
111
- echo pinned $DIRECTPIN directly >expected10
112
- ipfs pin add $DIRECTPIN >actual10
111
+ echo "pinned $DIRECTPIN directly" >expected10
112
+ ipfs pin add "$DIRECTPIN" >actual10
113
test_cmp expected10 actual10
114
'
115
116
test_expect_success "'ipfs pin ls -type=direct' is correct" '
117
- echo $DIRECTPIN >directpinexpected
117
+ echo "$DIRECTPIN" >directpinexpected
118
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >>directpinexpected
119
cat directpinexpected | sort >dp_exp_sorted
120
ipfs pin ls -type=direct | sort >directpinout
@@ -122,7 +122,7 @@ test_expect_success "'ipfs pin ls -type=direct' is correct" '
122
'
123
124
test_expect_success "'ipfs pin ls -type=recursive' is correct" '
125
- echo $MBLOCKHASH >rp_expected
125
+ echo "$MBLOCKHASH" >rp_expected
126
echo QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ >>rp_expected
127
cat rp_expected | sort >rp_exp_sorted
128
ipfs pin ls -type=recursive | sort >rp_actual
test/sharness/t0090-get.sh
+4
-4
@@ -46,7 +46,7 @@ test_expect_success "ipfs get -a succeeds" '
46
'
47
48
test_expect_success "ipfs get -a output looks good" '
49
- echo "Saving archive to "$HASH".tar
49
+ echo "Saving archive to $HASH.tar
50
" >expected &&
51
test_cmp expected actual
52
'
@@ -63,7 +63,7 @@ test_expect_success "ipfs get -a -C succeeds" '
63
'
64
65
test_expect_success "ipfs get -a -C output looks good" '
66
- echo "Saving archive to "$HASH".tar.gz
66
+ echo "Saving archive to $HASH.tar.gz
67
" >expected &&
68
test_cmp expected actual
69
'
@@ -85,7 +85,7 @@ test_expect_success "ipfs get succeeds (directory)" '
85
'
86
87
test_expect_success "ipfs get output looks good (directory)" '
88
- echo "Saving file(s) to "$HASH2"
88
+ echo "Saving file(s) to $HASH2
89
" >expected &&
90
test_cmp expected actual
91
'
@@ -101,7 +101,7 @@ test_expect_success "ipfs get -a -C succeeds (directory)" '
101
'
102
103
test_expect_success "ipfs get -a -C output looks good (directory)" '
104
- echo "Saving archive to "$HASH2".tar.gz
104
+ echo "Saving archive to $HASH2.tar.gz
105
" >expected &&
106
test_cmp expected actual
107
'