diff options
| author | Carlos Martín Nieto <cmn@elego.de> | 2011-06-14 14:26:08 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@elego.de> | 2011-06-14 14:26:08 +0200 |
| commit | a98b0d80dcfdc088419546e856eca43c1c1c1e9e (patch) | |
| tree | b801cb272148e9d190e8c3a4105785bd2ed540d0 /tests/t15-config.c | |
| parent | 711b1096f361ccdadfd3b316e41ca93ce1757975 (diff) | |
| download | libgit2-a98b0d80dcfdc088419546e856eca43c1c1c1e9e.tar.gz | |
Test replacing a value
Add a test to check that value replacement works.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'tests/t15-config.c')
| -rw-r--r-- | tests/t15-config.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/t15-config.c b/tests/t15-config.c index 08a2cdbf2..c11c5a932 100644 --- a/tests/t15-config.c +++ b/tests/t15-config.c @@ -189,6 +189,27 @@ BEGIN_TEST(config8, "don't fail on empty files") git_config_free(cfg); END_TEST +BEGIN_TEST +(config9, "replace a value") + git_config *cfg; + int i; + + /* By freeing the config, we make sure we flush the values */ + must_pass(git_config_open_file(&cfg, CONFIG_BASE "/config9")); + must_pass(git_config_set_int(cfg, "core.dummy", 5)); + git_config_free(cfg); + + must_pass(git_config_open_file(&cfg, CONFIG_BASE "/config9")); + must_pass(git_config_get_int(cfg, "core.dummy", &i)); + must_be_true(i == 5); + git_config_free(cfg); + + must_pass(git_config_open_file(&cfg, CONFIG_BASE "/config9")); + must_pass(git_config_set_int(cfg, "core.dummy", 1)); + git_config_free(cfg); + +END_TEST + BEGIN_SUITE(config) ADD_TEST(config0); ADD_TEST(config1); @@ -199,4 +220,5 @@ BEGIN_SUITE(config) ADD_TEST(config6); ADD_TEST(config7); ADD_TEST(config8); + ADD_TEST(config9); END_SUITE |
