aboutsummaryrefslogtreecommitdiff
path: root/t/t1300-config.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t1300-config.sh')
-rwxr-xr-xt/t1300-config.sh92
1 files changed, 87 insertions, 5 deletions
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 358d636379..128971ee12 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -1232,12 +1232,12 @@ test_expect_success SYMLINKS 'symlinked configuration' '
test_when_finished "rm myconfig" &&
ln -s notyet myconfig &&
git config --file=myconfig test.frotz nitfol &&
- test -h myconfig &&
- test -f notyet &&
+ test_path_is_symlink myconfig &&
+ test_path_is_file notyet &&
test "z$(git config --file=notyet test.frotz)" = znitfol &&
git config --file=myconfig test.xyzzy rezrov &&
- test -h myconfig &&
- test -f notyet &&
+ test_path_is_symlink myconfig &&
+ test_path_is_file notyet &&
cat >expect <<-\EOF &&
nitfol
rezrov
@@ -2459,9 +2459,15 @@ done
cat >.git/config <<-\EOF &&
[section]
-foo = true
+foo = True
number = 10
big = 1M
+path = ~/dir
+red = red
+blue = Blue
+date = Fri Jun 4 15:46:55 2010
+missing=:(optional)no-such-path
+exists=:(optional)expect
EOF
test_expect_success 'identical modern --type specifiers are allowed' '
@@ -2503,6 +2509,82 @@ test_expect_success 'unset type specifiers may be reset to conflicting ones' '
test_cmp_config 1048576 --type=bool --no-type --type=int section.big
'
+test_expect_success 'list --type=int shows only canonicalizable int values' '
+ cat >expect <<-EOF &&
+ section.number=10
+ section.big=1048576
+ EOF
+
+ git config ${mode_prefix}list --type=int >actual 2>err &&
+ test_cmp expect actual &&
+ test_must_be_empty err
+'
+
+test_expect_success 'list --type=bool shows only canonicalizable bool values' '
+ cat >expect <<-EOF &&
+ section.foo=true
+ section.number=true
+ section.big=true
+ EOF
+
+ git config ${mode_prefix}list --type=bool >actual 2>err &&
+ test_cmp expect actual &&
+ test_must_be_empty err
+'
+
+test_expect_success 'list --type=bool-or-int shows only canonicalizable values' '
+ cat >expect <<-EOF &&
+ section.foo=true
+ section.number=10
+ section.big=1048576
+ EOF
+
+ git config ${mode_prefix}list --type=bool-or-int >actual 2>err &&
+ test_cmp expect actual &&
+ test_must_be_empty err
+'
+
+test_expect_success 'list --type=path shows only canonicalizable path values' '
+ cat >expect <<-EOF &&
+ section.foo=True
+ section.number=10
+ section.big=1M
+ section.path=$HOME/dir
+ section.red=red
+ section.blue=Blue
+ section.date=Fri Jun 4 15:46:55 2010
+ section.exists=expect
+ EOF
+
+ git config ${mode_prefix}list --type=path >actual 2>err &&
+ test_cmp expect actual &&
+ test_must_be_empty err
+'
+
+test_expect_success 'list --type=expiry-date shows only canonicalizable dates' '
+ git config ${mode_prefix}list --type=expiry-date >actual 2>err &&
+
+ # section.number and section.big parse as relative dates that could
+ # have clock skew in their results.
+ test_grep section.big actual &&
+ test_grep section.number actual &&
+ test_grep "section.date=$(git config --type=expiry-date section.$key)" actual &&
+ test_must_be_empty err
+'
+
+test_expect_success 'list --type=color shows only canonicalizable color values' '
+ cat >expect <<-EOF &&
+ section.number=<>
+ section.red=<RED>
+ section.blue=<BLUE>
+ EOF
+
+ git config ${mode_prefix}list --type=color >actual.raw 2>err &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect actual &&
+ test_must_be_empty err
+'
+
test_expect_success '--type rejects unknown specifiers' '
test_must_fail git config --type=nonsense section.foo 2>error &&
test_grep "unrecognized --type argument" error