summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-06-28 16:48:04 +0200
committerVicent Marti <tanoku@gmail.com>2011-07-05 02:32:18 +0200
commit7d69f78897fc079a58059d9a84ab5928161d78cb (patch)
tree790c0199c03d6668cc0a3a8e292639af36d479e7
parent156af801e686e34685e2ac078a48d8224f3e33b4 (diff)
downloadlibgit2-7d69f78897fc079a58059d9a84ab5928161d78cb.tar.gz
Add variable writing tests
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
-rw-r--r--tests/t15-config.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/t15-config.c b/tests/t15-config.c
index a4e11c3c..c85d336a 100644
--- a/tests/t15-config.c
+++ b/tests/t15-config.c
@@ -271,6 +271,32 @@ BEGIN_TEST(config14, "don't fail horribly if a section header is in the last lin
git_config_free(cfg);
END_TEST
+BEGIN_TEST(config15, "add a variable in an existing section")
+ git_config *cfg;
+ int i;
+
+ /* By freeing the config, we make sure we flush the values */
+ must_pass(git_config_open_ondisk(&cfg, CONFIG_BASE "/config10"));
+ must_pass(git_config_set_int(cfg, "empty.tmp", 5));
+ must_pass(git_config_get_int(cfg, "empty.tmp", &i));
+ must_be_true(i == 5);
+ must_pass(git_config_del(cfg, "empty.tmp"));
+ git_config_free(cfg);
+END_TEST
+
+BEGIN_TEST(config16, "add a variable in a new section")
+ git_config *cfg;
+ int i;
+
+ /* By freeing the config, we make sure we flush the values */
+ must_pass(git_config_open_ondisk(&cfg, CONFIG_BASE "/config10"));
+ must_pass(git_config_set_int(cfg, "section.tmp", 5));
+ must_pass(git_config_get_int(cfg, "section.tmp", &i));
+ must_be_true(i == 5);
+ must_pass(git_config_del(cfg, "section.tmp"));
+ git_config_free(cfg);
+END_TEST
+
BEGIN_SUITE(config)
ADD_TEST(config0);
ADD_TEST(config1);
@@ -287,4 +313,6 @@ BEGIN_SUITE(config)
ADD_TEST(config12);
ADD_TEST(config13);
ADD_TEST(config14);
+ ADD_TEST(config15);
+ ADD_TEST(config16);
END_SUITE