t1430: test the output and error of some commands more carefully

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Apr 7, 2016 at 15:02 UTC f86d8350c8c72851dc9c250dbf0a6f1254e59282
1 file changed +12 -6
t/t1430-bad-ref-name.sh
+12 -6
@@ -42,7 +42,7 @@ test_expect_success 'git branch shows badly named ref as warning' '
42 cp .git/refs/heads/master .git/refs/heads/broken...ref &&
43 test_when_finished "rm -f .git/refs/heads/broken...ref" &&
44 git branch >output 2>error &&
45 - grep -e "broken\.\.\.ref" error &&
45 + test_i18ngrep -e "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
46 ! grep -e "broken\.\.\.ref" output
47 '
48
@@ -152,21 +152,25 @@ test_expect_success 'rev-parse skips symref pointing to broken name' '
152 git rev-parse --verify one >expect &&
153 git rev-parse --verify shadow >actual 2>err &&
154 test_cmp expect actual &&
155 - test_i18ngrep "ignoring.*refs/tags/shadow" err
155 + test_i18ngrep "ignoring dangling symref refs/tags/shadow" err
156 '
157
158 test_expect_success 'update-ref --no-deref -d can delete reference to broken name' '
159 git symbolic-ref refs/heads/badname refs/heads/broken...ref &&
160 test_when_finished "rm -f .git/refs/heads/badname" &&
161 test_path_is_file .git/refs/heads/badname &&
162 - git update-ref --no-deref -d refs/heads/badname &&
163 - test_path_is_missing .git/refs/heads/badname
162 + git update-ref --no-deref -d refs/heads/badname >output 2>error &&
163 + test_path_is_missing .git/refs/heads/badname &&
164 + test_must_be_empty output &&
165 + test_must_be_empty error
166 '
167
168 test_expect_success 'update-ref -d can delete broken name' '
169 cp .git/refs/heads/master .git/refs/heads/broken...ref &&
170 test_when_finished "rm -f .git/refs/heads/broken...ref" &&
169 - git update-ref -d refs/heads/broken...ref &&
171 + git update-ref -d refs/heads/broken...ref >output 2>error &&
172 + test_must_be_empty output &&
173 + test_must_be_empty error &&
174 git branch >output 2>error &&
175 ! grep -e "broken\.\.\.ref" error &&
176 ! grep -e "broken\.\.\.ref" output
@@ -175,7 +179,9 @@ test_expect_success 'update-ref -d can delete broken name' '
179 test_expect_success 'update-ref -d cannot delete non-ref in .git dir' '
180 echo precious >.git/my-private-file &&
181 echo precious >expect &&
178 - test_must_fail git update-ref -d my-private-file &&
182 + test_must_fail git update-ref -d my-private-file >output 2>error &&
183 + test_must_be_empty output &&
184 + test_i18ngrep -e "cannot lock .*: unable to resolve reference" error &&
185 test_cmp expect .git/my-private-file
186 '
187