add a test for semantic errors in config files

Semantic errors (for example, for alias.* variables NULL values are not allowed) in configuration files cause a die printing the line number and file name of the offending value. Add a test documenting that such errors cause a die printing the accurate line number and file name. Signed-off-by: Tanay Abhra <tanayabh@gmail.com> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Tanay Abhra committed Aug 7, 2014 at 04:59 UTC 79e9ce21fa728edef5b7db12710ae24e091b8f9f
1 file changed +11
t/t1308-config-set.sh
+11
@@ -197,4 +197,15 @@ test_expect_success 'proper error on error in custom config files' '
197 test_cmp expect actual
198 '
199
200 +test_expect_success 'check line errors for malformed values' '
201 + mv .git/config .git/config.old &&
202 + test_when_finished "mv .git/config.old .git/config" &&
203 + cat >.git/config <<-\EOF &&
204 + [alias]
205 + br
206 + EOF
207 + test_expect_code 128 git br 2>result &&
208 + test_i18ngrep "fatal: .*alias\.br.*\.git/config.*line 2" result
209 +'
210 +
211 test_done