t1400: avoid "test" string comparisons
Using the shell "test" here is inflexible, because we can't easily swap it out for an i18n-aware version like we can with test_cmp and test_i18ncmp. And it's not even saving us any processes, since we have to use "cat" to get the output. So let's switch to using test_cmp, which has the added bonus that it will produce better output if there's a failure. Note that not all of the changed outputs here are candidates for translation, but I've converted all of them for consistency and to benefit from the better output. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a0ba80001a
commit
e5d7b2f65c
@ -361,55 +361,67 @@ ld="Thu, 26 May 2005 18:43:00 -0500"
|
||||
test_expect_success 'Query "master@{May 25 2005}" (before history)' '
|
||||
test_when_finished "rm -f o e" &&
|
||||
git rev-parse --verify "master@{May 25 2005}" >o 2>e &&
|
||||
test $C = $(cat o) &&
|
||||
test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
|
||||
echo "$C" >expect &&
|
||||
test_cmp expect o &&
|
||||
echo "warning: Log for '\''master'\'' only goes back to $ed." >expect &&
|
||||
test_cmp expect e
|
||||
'
|
||||
test_expect_success 'Query master@{2005-05-25} (before history)' '
|
||||
test_when_finished "rm -f o e" &&
|
||||
git rev-parse --verify master@{2005-05-25} >o 2>e &&
|
||||
test $C = $(cat o) &&
|
||||
test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
|
||||
echo "$C" >expect &&
|
||||
test_cmp expect o &&
|
||||
echo "warning: Log for '\''master'\'' only goes back to $ed." >expect &&
|
||||
test_cmp expect e
|
||||
'
|
||||
test_expect_success 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' '
|
||||
test_when_finished "rm -f o e" &&
|
||||
git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
|
||||
test $C = $(cat o) &&
|
||||
test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
|
||||
echo "$C" >expect &&
|
||||
test_cmp expect o &&
|
||||
echo "warning: Log for '\''master'\'' only goes back to $ed." >expect &&
|
||||
test_cmp expect e
|
||||
'
|
||||
test_expect_success 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' '
|
||||
test_when_finished "rm -f o e" &&
|
||||
git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
|
||||
test $C = $(cat o) &&
|
||||
echo "$C" >expect &&
|
||||
test_cmp expect o &&
|
||||
test_must_be_empty e
|
||||
'
|
||||
test_expect_success 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' '
|
||||
test_when_finished "rm -f o e" &&
|
||||
git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
|
||||
test $A = $(cat o) &&
|
||||
echo "$A" >expect &&
|
||||
test_cmp expect o &&
|
||||
test_must_be_empty e
|
||||
'
|
||||
test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' '
|
||||
test_when_finished "rm -f o e" &&
|
||||
git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
|
||||
test $B = $(cat o) &&
|
||||
echo "$B" >expect &&
|
||||
test_cmp expect o &&
|
||||
test_i18ngrep -F "warning: log for ref $m has gap after $gd" e
|
||||
'
|
||||
test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
|
||||
test_when_finished "rm -f o e" &&
|
||||
git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
|
||||
test $Z = $(cat o) &&
|
||||
echo "$Z" >expect &&
|
||||
test_cmp expect o &&
|
||||
test_must_be_empty e
|
||||
'
|
||||
test_expect_success 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' '
|
||||
test_when_finished "rm -f o e" &&
|
||||
git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
|
||||
test $E = $(cat o) &&
|
||||
echo "$E" >expect &&
|
||||
test_cmp expect o &&
|
||||
test_must_be_empty e
|
||||
'
|
||||
test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
|
||||
test_when_finished "rm -f o e" &&
|
||||
git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
|
||||
test $D = $(cat o) &&
|
||||
echo "$D" >expect &&
|
||||
test_cmp expect o &&
|
||||
test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e
|
||||
'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user