@@ -36,66 +36,41 @@ $content"
36
36
'
37
37
38
38
test_expect_success " Type of $type is correct" '
39
- test $type = "$(git cat-file -t $sha1)"
39
+ echo $type >expect &&
40
+ git cat-file -t $sha1 >actual &&
41
+ test_cmp expect actual
40
42
'
41
43
42
44
test_expect_success " Size of $type is correct" '
43
- test $size = "$(git cat-file -s $sha1)"
45
+ echo $size >expect &&
46
+ git cat-file -s $sha1 >actual &&
47
+ test_cmp expect actual
44
48
'
45
49
46
50
test -z " $content " ||
47
51
test_expect_success " Content of $type is correct" '
48
- expect="$(maybe_remove_timestamp "$content" $no_ts)"
49
- actual="$(maybe_remove_timestamp "$(git cat-file $type $sha1)" $no_ts)"
50
-
51
- if test "z$expect" = "z$actual"
52
- then
53
- : happy
54
- else
55
- echo "Oops: expected $expect"
56
- echo "but got $actual"
57
- false
58
- fi
52
+ maybe_remove_timestamp "$content" $no_ts >expect &&
53
+ maybe_remove_timestamp "$(git cat-file $type $sha1)" $no_ts >actual &&
54
+ test_cmp expect actual
59
55
'
60
56
61
57
test_expect_success " Pretty content of $type is correct" '
62
- expect="$(maybe_remove_timestamp "$pretty_content" $no_ts)"
63
- actual="$(maybe_remove_timestamp "$(git cat-file -p $sha1)" $no_ts)"
64
- if test "z$expect" = "z$actual"
65
- then
66
- : happy
67
- else
68
- echo "Oops: expected $expect"
69
- echo "but got $actual"
70
- false
71
- fi
58
+ maybe_remove_timestamp "$pretty_content" $no_ts >expect &&
59
+ maybe_remove_timestamp "$(git cat-file -p $sha1)" $no_ts >actual &&
60
+ test_cmp expect actual
72
61
'
73
62
74
63
test -z " $content " ||
75
64
test_expect_success " --batch output of $type is correct" '
76
- expect="$(maybe_remove_timestamp "$batch_output" $no_ts)"
77
- actual="$(maybe_remove_timestamp "$(echo $sha1 | git cat-file --batch)" $no_ts)"
78
- if test "z$expect" = "z$actual"
79
- then
80
- : happy
81
- else
82
- echo "Oops: expected $expect"
83
- echo "but got $actual"
84
- false
85
- fi
65
+ maybe_remove_timestamp "$batch_output" $no_ts >expect &&
66
+ maybe_remove_timestamp "$(echo $sha1 | git cat-file --batch)" $no_ts >actual &&
67
+ test_cmp expect actual
86
68
'
87
69
88
70
test_expect_success " --batch-check output of $type is correct" '
89
- expect="$sha1 $type $size"
90
- actual="$(echo_without_newline $sha1 | git cat-file --batch-check)"
91
- if test "z$expect" = "z$actual"
92
- then
93
- : happy
94
- else
95
- echo "Oops: expected $expect"
96
- echo "but got $actual"
97
- false
98
- fi
71
+ echo "$sha1 $type $size" >expect &&
72
+ echo_without_newline $sha1 | git cat-file --batch-check >actual &&
73
+ test_cmp expect actual
99
74
'
100
75
}
101
76
0 commit comments