diff options
author | Michael Muré <batolettre@gmail.com> | 2021-03-28 22:18:01 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-03-28 22:18:01 +0200 |
commit | 890c014d919f705eac624547031c79205a71321b (patch) | |
tree | 062d022679c941cd7eabb40f5b22a3da35efd8af /repository/config_testing.go | |
parent | fb6b2d873e1bbc653aa84ddce56c842202e00c33 (diff) | |
download | git-bug-890c014d919f705eac624547031c79205a71321b.tar.gz |
repo: fix various config issues around case insentivity
Diffstat (limited to 'repository/config_testing.go')
-rw-r--r-- | repository/config_testing.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/repository/config_testing.go b/repository/config_testing.go index 445f8721..f8a2762b 100644 --- a/repository/config_testing.go +++ b/repository/config_testing.go @@ -113,4 +113,43 @@ func testConfig(t *testing.T, config Config) { "section.subsection.subsection.opt1": "foo5", "section.subsection.subsection.opt2": "foo6", }, all) + + // missing section + case insensitive + val, err = config.ReadString("section2.opt1") + require.Error(t, err) + + val, err = config.ReadString("section.opt1") + require.NoError(t, err) + require.Equal(t, "foo", val) + + val, err = config.ReadString("SECTION.OPT1") + require.NoError(t, err) + require.Equal(t, "foo", val) + + _, err = config.ReadString("SECTION2.OPT3") + require.Error(t, err) + + // missing subsection + case insensitive + val, err = config.ReadString("section.subsection.opt1") + require.NoError(t, err) + require.Equal(t, "foo3", val) + + // for some weird reason, subsection ARE case sensitive + _, err = config.ReadString("SECTION.SUBSECTION.OPT1") + require.Error(t, err) + + _, err = config.ReadString("SECTION.SUBSECTION1.OPT1") + require.Error(t, err) + + // missing sub-subsection + case insensitive + val, err = config.ReadString("section.subsection.subsection.opt1") + require.NoError(t, err) + require.Equal(t, "foo5", val) + + // for some weird reason, subsection ARE case sensitive + _, err = config.ReadString("SECTION.SUBSECTION.SUBSECTION.OPT1") + require.Error(t, err) + + _, err = config.ReadString("SECTION.SUBSECTION.SUBSECTION1.OPT1") + require.Error(t, err) } |