diff options
author | Jeff King <peff@peff.net> | 2020-01-24 19:06:24 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-01-28 14:41:39 -0800 |
commit | e5d7b2f65cadf9caa2097083b3bed4f6bce32fb9 (patch) | |
tree | ee795cef0e50926ae80d26e07286ae5b6b4e206c /t | |
parent | .mailmap: fix erroneous authorship for Johannes Schindelin (diff) | |
download | tgif-e5d7b2f65cadf9caa2097083b3bed4f6bce32fb9.tar.xz |
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>
Diffstat (limited to 't')
-rwxr-xr-x | t/t1400-update-ref.sh | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index b815cdd1b8..a86dd2fbd9 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -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 ' |