rev-parse test: use test_cmp instead of "test" builtin
commitc812be9d81cf1fc587695d985bced50258b53d31
authorJonathan Nieder <jrnieder@gmail.com>
Tue, 3 Sep 2013 17:07:15 +0000 (3 10:07 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Sep 2013 19:55:30 +0000 (3 12:55 -0700)
tree1b1eb1a219314f635b1bfa30f7550c75d5f15a47
parentd8f7681337dd0c7944ba2293a72952110977077d
rev-parse test: use test_cmp instead of "test" builtin

Use test_cmp instead of passing two command substitutions to the
"test" builtin.  This way:

 - when tests fail, they can print a helpful diff if run with
   "--verbose"

 - the argument order "test_cmp expect actual" feels natural,
   unlike test <known> = <unknown> that seems backwards

 - the exit status from invoking git is checked, so if rev-parse
   starts segfaulting then the test will notice and fail

Use a custom function for this instead of test_cmp_rev to emphasize
that we are testing the output from "git rev-parse" with certain
arguments, not checking that the revisions are equal in abstract.

Reported-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6101-rev-parse-parents.sh