config: test for a variable on its own

If a variable is on its own, truth should be assumed. Check this is
true in our code.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
This commit is contained in:
Carlos Martín Nieto 2011-04-04 17:07:47 +02:00
parent 2470be13f2
commit 8cd767ef52
2 changed files with 17 additions and 0 deletions

Binary file not shown.

View File

@ -112,10 +112,27 @@ BEGIN_TEST(config3, "parse a [section.subsection] header")
git_config_free(cfg);
END_TEST
BEGIN_TEST(config4, "a variable name on its own is valid")
git_config *cfg;
const char *str;
int i;
must_pass(git_config_open(&cfg, CONFIG_BASE "/config4"));
must_pass(git_config_get_string(cfg, "some.section.variable", &str));
must_be_true(str == NULL);
must_pass(git_config_get_bool(cfg, "some.section.variable", &i));
must_be_true(i == 1);
git_config_free(cfg);
END_TEST
BEGIN_SUITE(config)
ADD_TEST(config0);
ADD_TEST(config1);
ADD_TEST(config2);
ADD_TEST(config3);
ADD_TEST(config4);
END_SUITE