Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Rogers <alanjrogers@me.com>2014-10-16 06:52:55 +0400
committerAlan Rogers <alanjrogers@me.com>2014-10-23 08:21:04 +0400
commit5490c9d47036c44a255d3177f93664f4e034834b (patch)
tree63bc98bb249247b5dc95df0ea18d5d96189f09e6 /tests/config
parente0383fa35f981c656043976a43c61bff059cb709 (diff)
Add a test to make sure a new snapshot has the new value.
Diffstat (limited to 'tests/config')
-rw-r--r--tests/config/snapshot.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/config/snapshot.c b/tests/config/snapshot.c
index c9f15921a..d8e6f4e3b 100644
--- a/tests/config/snapshot.c
+++ b/tests/config/snapshot.c
@@ -3,7 +3,7 @@
void test_config_snapshot__create_snapshot(void)
{
int32_t tmp;
- git_config *cfg, *snapshot;
+ git_config *cfg, *snapshot, *new_snapshot;
const char *filename = "config-ext-change";
cl_git_mkfile(filename, "[old]\nvalue = 5\n");
@@ -23,6 +23,19 @@ void test_config_snapshot__create_snapshot(void)
cl_git_pass(git_config_get_int32(&tmp, snapshot, "old.value"));
cl_assert_equal_i(5, tmp);
+
+ /* Change the value on the file itself (simulate external process) */
+ cl_git_mkfile(filename, "[old]\nvalue = 99\n");
+
+ cl_git_pass(git_config_snapshot(&new_snapshot, cfg));
+
+ /* New snapshot should see new value */
+ cl_git_pass(git_config_get_int32(&tmp, new_snapshot, "old.value"));
+ cl_assert_equal_i(99, tmp);
+
+ /* Old snapshot should still have the old value */
+ cl_git_pass(git_config_get_int32(&tmp, snapshot, "old.value"));
+ cl_assert_equal_i(5, tmp);
git_config_free(snapshot);
git_config_free(cfg);