@matheusbsbs / matheus-bagliano / commits / 09bc098c2d
Fork 0

config: add test cases for empty value and no value config variables.

The tests in 't1300-repo-config.sh' did not check what happens when an empty value like the following is used in the config file: [emptyvalue] variable = Also it was not checked that a variable with no value like the following: [novalue] variable gives a boolean "true" value, while an ampty value gives a boolean "false" value. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Feb 7, 2008 at 06:23 UTC 09bc098c2db106469f79eae5e4f6a3bc09c0db12
1 file changed +23
t/t1300-repo-config.sh
+23
@@ -283,17 +283,40 @@ test_expect_success '--add' \
283 cat > .git/config << EOF
284 [novalue]
285 variable
286 +[emptyvalue]
287 + variable =
288 EOF
289
290 test_expect_success 'get variable with no value' \
291 'git config --get novalue.variable ^$'
292
293 +test_expect_success 'get variable with empty value' \
294 + 'git config --get emptyvalue.variable ^$'
295 +
296 echo novalue.variable > expect
297
298 test_expect_success 'get-regexp variable with no value' \
299 'git config --get-regexp novalue > output &&
300 cmp output expect'
301
302 +echo 'emptyvalue.variable ' > expect
303 +
304 +test_expect_success 'get-regexp variable with empty value' \
305 + 'git config --get-regexp emptyvalue > output &&
306 + cmp output expect'
307 +
308 +echo true > expect
309 +
310 +test_expect_success 'get bool variable with no value' \
311 + 'git config --bool novalue.variable > output &&
312 + cmp output expect'
313 +
314 +echo false > expect
315 +
316 +test_expect_success 'get bool variable with empty value' \
317 + 'git config --bool emptyvalue.variable > output &&
318 + cmp output expect'
319 +
320 git config > output 2>&1
321
322 test_expect_success 'no arguments, but no crash' \