t1400: test one mistake at a time
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 7 Apr 2014 13:48:07 +0000 (15:48 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Apr 2014 19:09:13 +0000 (12:09 -0700)
This case wants to test passing a bad refname to the "update" command.
But it also passes too few arguments to "update", which muddles the
situation: which error should be diagnosed? So split this test into
two:

* One that passes too few arguments to update

* One that passes all three arguments to "update", but with a bad
refname.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1400-update-ref.sh
index 2d61cceb4c4b536249aaa61871604e6848b40247..6b21e459e6f4a96b0073576633522fb19c95c273 100755 (executable)
@@ -724,8 +724,14 @@ test_expect_success 'stdin -z fails update with no ref' '
        grep "fatal: update line missing <ref>" err
 '
 
+test_expect_success 'stdin -z fails update with too few args' '
+       printf $F "update $a" "$m" >stdin &&
+       test_must_fail git update-ref -z --stdin <stdin 2>err &&
+       grep "fatal: update $a missing <oldvalue>" err
+'
+
 test_expect_success 'stdin -z fails update with bad ref name' '
-       printf $F "update ~a" "$m" >stdin &&
+       printf $F "update ~a" "$m" "" >stdin &&
        test_must_fail git update-ref -z --stdin <stdin 2>err &&
        grep "fatal: invalid ref format: ~a" err
 '