diff options
author | Michael Muré <batolettre@gmail.com> | 2021-03-28 22:25:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-28 22:25:12 +0200 |
commit | 919227c6dafffaa2e4c497c0a514d75dcf168045 (patch) | |
tree | 062d022679c941cd7eabb40f5b22a3da35efd8af /repository/config_testing.go | |
parent | fb6b2d873e1bbc653aa84ddce56c842202e00c33 (diff) | |
parent | 890c014d919f705eac624547031c79205a71321b (diff) | |
download | git-bug-919227c6dafffaa2e4c497c0a514d75dcf168045.tar.gz |
Merge pull request #608 from MichaelMure/fix-config
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) } |