summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-02-09 13:02:26 +0000
committerPatrick Steinhardt <ps@pks.im>2018-03-26 10:15:16 +0100
commit6a15f657e749dc251049b0152e180264482b11fa (patch)
tree3642daab14e5135604933e0ccb9a58815fc988a6 /tests
parent3a82475f327775f0320f7e9ff333c43944ec63ff (diff)
downloadlibgit2-6a15f657e749dc251049b0152e180264482b11fa.tar.gz
config_file: iterate over keys in the order they were added
Currently, all configuration entries were only held in a string map, making iteration order mostly based on the hash of each entry's key. Now that we have extended the `diskfile_entries` structure by a list of config entries, we can effectively iterate through entries in the order they were added, though.
Diffstat (limited to 'tests')
-rw-r--r--tests/config/read.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/config/read.c b/tests/config/read.c
index a34455a0c..ebcd2eb84 100644
--- a/tests/config/read.c
+++ b/tests/config/read.c
@@ -306,6 +306,15 @@ void test_config_read__foreach(void)
void test_config_read__iterator(void)
{
+ const char *keys[] = {
+ "core.dummy2",
+ "core.verylong",
+ "core.dummy",
+ "remote.ab.url",
+ "remote.abba.url",
+ "core.dummy2",
+ "core.global"
+ };
git_config *cfg;
git_config_iterator *iter;
git_config_entry *entry;
@@ -321,6 +330,7 @@ void test_config_read__iterator(void)
cl_git_pass(git_config_iterator_new(&iter, cfg));
while ((ret = git_config_next(&entry, iter)) == 0) {
+ cl_assert_equal_s(entry->name, keys[count]);
count++;
}