mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-22 18:37:52 +00:00
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:
parent
2470be13f2
commit
8cd767ef52
BIN
tests/resources/config/config4
Normal file
BIN
tests/resources/config/config4
Normal file
Binary file not shown.
@ -112,10 +112,27 @@ BEGIN_TEST(config3, "parse a [section.subsection] header")
|
|||||||
git_config_free(cfg);
|
git_config_free(cfg);
|
||||||
END_TEST
|
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)
|
BEGIN_SUITE(config)
|
||||||
ADD_TEST(config0);
|
ADD_TEST(config0);
|
||||||
ADD_TEST(config1);
|
ADD_TEST(config1);
|
||||||
ADD_TEST(config2);
|
ADD_TEST(config2);
|
||||||
ADD_TEST(config3);
|
ADD_TEST(config3);
|
||||||
|
ADD_TEST(config4);
|
||||||
END_SUITE
|
END_SUITE
|
||||||
|
Loading…
Reference in New Issue
Block a user