@@ -36,66 +36,41 @@ $content"
3636 '
3737
3838 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
4042 '
4143
4244 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
4448 '
4549
4650 test -z " $content " ||
4751 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
5955 '
6056
6157 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
7261 '
7362
7463 test -z " $content " ||
7564 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
8668 '
8769
8870 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
9974 '
10075}
10176
0 commit comments