aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2008-02-07 06:23:46 +0100
committerJunio C Hamano <gitster@pobox.com>2008-02-13 14:23:32 -0800
commitd8e87570c32b190af3991d180f37adb8cf5eb99c (patch)
tree56f98cb6272d447963d3c0b42b517ad615b0fb42 /t
parent9386ecbb1cb0576f67da804f57dd96ffd62bb3c6 (diff)
downloadgit-d8e87570c32b190af3991d180f37adb8cf5eb99c.tar.gz
git-d8e87570c32b190af3991d180f37adb8cf5eb99c.tar.xz
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>
Diffstat (limited to 't')
-rwxr-xr-xt/t1300-repo-config.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 44dcc1f94..d9e358e1b 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -297,17 +297,40 @@ test_expect_success '--add' \
cat > .git/config << EOF
[novalue]
variable
+[emptyvalue]
+ variable =
EOF
test_expect_success 'get variable with no value' \
'git config --get novalue.variable ^$'
+test_expect_success 'get variable with empty value' \
+ 'git config --get emptyvalue.variable ^$'
+
echo novalue.variable > expect
test_expect_success 'get-regexp variable with no value' \
'git config --get-regexp novalue > output &&
cmp output expect'
+echo 'emptyvalue.variable ' > expect
+
+test_expect_success 'get-regexp variable with empty value' \
+ 'git config --get-regexp emptyvalue > output &&
+ cmp output expect'
+
+echo true > expect
+
+test_expect_success 'get bool variable with no value' \
+ 'git config --bool novalue.variable > output &&
+ cmp output expect'
+
+echo false > expect
+
+test_expect_success 'get bool variable with empty value' \
+ 'git config --bool emptyvalue.variable > output &&
+ cmp output expect'
+
git config > output 2>&1
test_expect_success 'no arguments, but no crash' \