@matheusbsbs / matheus-bagliano / commits / d8e87570c3
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 d8e87570c32b190af3991d180f37adb8cf5eb99c
1 file changed +23
t/t1300-repo-config.sh
+23
@@ -297,17 +297,40 @@ test_expect_success '--add' \
297 cat > .git/config << EOF
298 [novalue]
299 variable
300 +[emptyvalue]
301 + variable =
302 EOF
303
304 test_expect_success 'get variable with no value' \
305 'git config --get novalue.variable ^$'
306
307 +test_expect_success 'get variable with empty value' \
308 + 'git config --get emptyvalue.variable ^$'
309 +
310 echo novalue.variable > expect
311
312 test_expect_success 'get-regexp variable with no value' \
313 'git config --get-regexp novalue > output &&
314 cmp output expect'
315
316 +echo 'emptyvalue.variable ' > expect
317 +
318 +test_expect_success 'get-regexp variable with empty value' \
319 + 'git config --get-regexp emptyvalue > output &&
320 + cmp output expect'
321 +
322 +echo true > expect
323 +
324 +test_expect_success 'get bool variable with no value' \
325 + 'git config --bool novalue.variable > output &&
326 + cmp output expect'
327 +
328 +echo false > expect
329 +
330 +test_expect_success 'get bool variable with empty value' \
331 + 'git config --bool emptyvalue.variable > output &&
332 + cmp output expect'
333 +
334 git config > output 2>&1
335
336 test_expect_success 'no arguments, but no crash' \