Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 676ae6a

Browse files
committedMay 13, 2015
sharness: Follow the calling convention expected, actual
1 parent bd7c74d commit 676ae6a

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed
 

‎test/ipfs-test-lib.sh

+17-3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,24 @@ test_sort_cmp() {
2323
test_cmp "$1_sorted" "$2_sorted"
2424
}
2525

26-
# Similar to test_sort_cmp, but file A must have all lines of B, can have extra
26+
# Test whether all the expected lines are included in a file. The file
27+
# can have extra lines.
28+
#
29+
# $1 - Path to file with expected lines.
30+
# $2 - Path to file with actual output.
31+
#
32+
# Examples
33+
#
34+
# test_expect_success 'foo says hello' '
35+
# echo hello >expected &&
36+
# foo >actual &&
37+
# test_cmp expected actual
38+
# '
39+
#
40+
# Returns the exit code of the command set by TEST_CMP.
2741
test_includes_lines() {
2842
sort "$1" >"$1_sorted" &&
2943
sort "$2" >"$2_sorted" &&
30-
comm -1 -3 "$1_sorted" "$2_sorted" >"$1_missing" &&
31-
[ ! -s "$1_missing" ] || test_fsh comm -1 -3 "$1_sorted" "$2_sorted"
44+
comm -2 -3 "$1_sorted" "$2_sorted" >"$2_missing" &&
45+
[ ! -s "$2_missing" ] || test_fsh comm -2 -3 "$1_sorted" "$2_sorted"
3246
}

‎test/sharness/t0080-repo.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ test_expect_success "remove direct pin" '
8080
test_expect_success "'ipfs repo gc' removes file" '
8181
ipfs repo gc >actual7 &&
8282
echo "removed $HASH" >expected7 &&
83-
test_includes_lines actual7 expected7
83+
test_includes_lines expected7 actual7
8484
'
8585

8686
# TODO: there seems to be a serious bug with leveldb not returning a key.

‎test/sharness/t0081-repo-pinning.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ test_expect_success "'ipfs repo gc' succeeds" '
214214
echo "removed $HASH_FILE3" > gc_out_exp2 &&
215215
echo "removed $HASH_FILE5" >> gc_out_exp2 &&
216216
echo "removed $HASH_DIR3" >> gc_out_exp2 &&
217-
test_includes_lines gc_out_actual2 gc_out_exp2
217+
test_includes_lines gc_out_exp2 gc_out_actual2
218218
'
219219

220220
# use object links for HASH_DIR1 here because its children

0 commit comments

Comments
 (0)
Please sign in to comment.