@ -36,66 +36,41 @@ $content"
'
'
test_expect_success "Type of $type is correct" '
test_expect_success "Type of $type is correct" '
test $type = "$(git cat-file -t $sha1)"
echo $type >expect &&
git cat-file -t $sha1 >actual &&
test_cmp expect actual
'
'
test_expect_success "Size of $type is correct" '
test_expect_success "Size of $type is correct" '
test $size = "$(git cat-file -s $sha1)"
echo $size >expect &&
git cat-file -s $sha1 >actual &&
test_cmp expect actual
'
'
test -z "$content" ||
test -z "$content" ||
test_expect_success "Content of $type is correct" '
test_expect_success "Content of $type is correct" '
expect="$(maybe_remove_timestamp "$content" $no_ts)"
maybe_remove_timestamp "$content" $no_ts >expect &&
actual="$(maybe_remove_timestamp "$(git cat-file $type $sha1)" $no_ts)"
maybe_remove_timestamp "$(git cat-file $type $sha1)" $no_ts >actual &&
test_cmp expect actual
if test "z$expect" = "z$actual"
then
: happy
else
echo "Oops: expected $expect"
echo "but got $actual"
false
fi
'
'
test_expect_success "Pretty content of $type is correct" '
test_expect_success "Pretty content of $type is correct" '
expect="$(maybe_remove_timestamp "$pretty_content" $no_ts)"
maybe_remove_timestamp "$pretty_content" $no_ts >expect &&
actual="$(maybe_remove_timestamp "$(git cat-file -p $sha1)" $no_ts)"
maybe_remove_timestamp "$(git cat-file -p $sha1)" $no_ts >actual &&
if test "z$expect" = "z$actual"
test_cmp expect actual
then
: happy
else
echo "Oops: expected $expect"
echo "but got $actual"
false
fi
'
'
test -z "$content" ||
test -z "$content" ||
test_expect_success "--batch output of $type is correct" '
test_expect_success "--batch output of $type is correct" '
expect="$(maybe_remove_timestamp "$batch_output" $no_ts)"
maybe_remove_timestamp "$batch_output" $no_ts >expect &&
actual="$(maybe_remove_timestamp "$(echo $sha1 | git cat-file --batch)" $no_ts)"
maybe_remove_timestamp "$(echo $sha1 | git cat-file --batch)" $no_ts >actual &&
if test "z$expect" = "z$actual"
test_cmp expect actual
then
: happy
else
echo "Oops: expected $expect"
echo "but got $actual"
false
fi
'
'
test_expect_success "--batch-check output of $type is correct" '
test_expect_success "--batch-check output of $type is correct" '
expect="$sha1 $type $size"
echo "$sha1 $type $size" >expect &&
actual="$(echo_without_newline $sha1 | git cat-file --batch-check)"
echo_without_newline $sha1 | git cat-file --batch-check >actual &&
if test "z$expect" = "z$actual"
test_cmp expect actual
then
: happy
else
echo "Oops: expected $expect"
echo "but got $actual"
false
fi
'
'
}
}