diff options
| author | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-10-01 19:56:04 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-10-01 19:58:26 +0200 |
| commit | 9ac581bf7fffaf809214fdd950bb62d242ee52fe (patch) | |
| tree | d794ce4c31f6a9dd8e69ff6bd5f844c6730ea941 /tests/t15-config.c | |
| parent | 92be7908bd0fa344dc086d43685225ebd082eae2 (diff) | |
| download | libgit2-9ac581bf7fffaf809214fdd950bb62d242ee52fe.tar.gz | |
config: behave like git with [section.subsection]
The documentation is a bit misleading. The subsection name is always
case-sensitive, but with a [section.subsection] header, the subsection
is transformed to lowercase when the configuration is parsed.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'tests/t15-config.c')
| -rw-r--r-- | tests/t15-config.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/t15-config.c b/tests/t15-config.c index 3ec54feea..c4cb590f5 100644 --- a/tests/t15-config.c +++ b/tests/t15-config.c @@ -107,10 +107,8 @@ BEGIN_TEST(config3, "parse a [section.subsection] header") must_pass(git_config_get_string(cfg, "section.subsection.var", &str)); must_be_true(!strcmp(str, "hello")); - /* Avoid a false positive */ - str = "nohello"; - must_pass(git_config_get_string(cfg, "section.subSectIon.var", &str)); - must_be_true(!strcmp(str, "hello")); + /* The subsection is transformed to lower-case */ + must_fail(git_config_get_string(cfg, "section.subSectIon.var", &str)); git_config_free(cfg); END_TEST @@ -324,6 +322,20 @@ BEGIN_TEST(config16, "add a variable in a new section") must_pass(git_filebuf_commit(&buf)); END_TEST +BEGIN_TEST(config17, "prefixes aren't broken") + git_config *cfg; + const char *str; + + must_pass(git_config_open_ondisk(&cfg, CONFIG_BASE "/config9")); + must_pass(git_config_get_string(cfg, "remote.ab.url", &str)); + must_be_true(strcmp(str, "http://example.com/git/ab") == 0); + + must_pass(git_config_get_string(cfg, "remote.abba.url", &str)); + must_be_true(strcmp(str, "http://example.com/git/abba") == 0); + + git_config_free(cfg); +END_TEST + BEGIN_SUITE(config) ADD_TEST(config0); ADD_TEST(config1); @@ -342,4 +354,5 @@ BEGIN_SUITE(config) ADD_TEST(config14); ADD_TEST(config15); ADD_TEST(config16); + ADD_TEST(config17); END_SUITE |
