Commit 255c38c5 by Vicent Martí

global: Fix unit tests after reordering

parent 29e948de
...@@ -14,7 +14,7 @@ void test_attr_flags__bare(void) ...@@ -14,7 +14,7 @@ void test_attr_flags__bare(void)
cl_assert(git_repository_is_bare(repo)); cl_assert(git_repository_is_bare(repo));
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM, "README.md", "diff", &value)); &value, repo, GIT_ATTR_CHECK_NO_SYSTEM, "README.md", "diff"));
cl_assert(GIT_ATTR_UNSPECIFIED(value)); cl_assert(GIT_ATTR_UNSPECIFIED(value));
} }
...@@ -27,34 +27,34 @@ void test_attr_flags__index_vs_workdir(void) ...@@ -27,34 +27,34 @@ void test_attr_flags__index_vs_workdir(void)
/* wd then index */ /* wd then index */
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"README.md", "bar", &value)); "README.md", "bar"));
cl_assert(GIT_ATTR_FALSE(value)); cl_assert(GIT_ATTR_FALSE(value));
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"README.md", "blargh", &value)); "README.md", "blargh"));
cl_assert_equal_s(value, "goop"); cl_assert_equal_s(value, "goop");
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"README.txt", "foo", &value)); "README.txt", "foo"));
cl_assert(GIT_ATTR_FALSE(value)); cl_assert(GIT_ATTR_FALSE(value));
/* index then wd */ /* index then wd */
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"README.md", "bar", &value)); "README.md", "bar"));
cl_assert(GIT_ATTR_TRUE(value)); cl_assert(GIT_ATTR_TRUE(value));
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"README.md", "blargh", &value)); "README.md", "blargh"));
cl_assert_equal_s(value, "garble"); cl_assert_equal_s(value, "garble");
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"README.txt", "foo", &value)); "README.txt", "foo"));
cl_assert(GIT_ATTR_TRUE(value)); cl_assert(GIT_ATTR_TRUE(value));
} }
...@@ -65,44 +65,44 @@ void test_attr_flags__subdir(void) ...@@ -65,44 +65,44 @@ void test_attr_flags__subdir(void)
/* wd then index */ /* wd then index */
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"sub/sub/README.md", "bar", &value)); "sub/sub/README.md", "bar"));
cl_assert_equal_s(value, "1234"); cl_assert_equal_s(value, "1234");
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"sub/sub/README.txt", "another", &value)); "sub/sub/README.txt", "another"));
cl_assert_equal_s(value, "one"); cl_assert_equal_s(value, "one");
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"sub/sub/README.txt", "again", &value)); "sub/sub/README.txt", "again"));
cl_assert(GIT_ATTR_TRUE(value)); cl_assert(GIT_ATTR_TRUE(value));
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"sub/sub/README.txt", "beep", &value)); "sub/sub/README.txt", "beep"));
cl_assert_equal_s(value, "10"); cl_assert_equal_s(value, "10");
/* index then wd */ /* index then wd */
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"sub/sub/README.md", "bar", &value)); "sub/sub/README.md", "bar"));
cl_assert_equal_s(value, "1337"); cl_assert_equal_s(value, "1337");
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"sub/sub/README.txt", "another", &value)); "sub/sub/README.txt", "another"));
cl_assert_equal_s(value, "one"); cl_assert_equal_s(value, "one");
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"sub/sub/README.txt", "again", &value)); "sub/sub/README.txt", "again"));
cl_assert(GIT_ATTR_TRUE(value)); cl_assert(GIT_ATTR_TRUE(value));
cl_git_pass(git_attr_get( cl_git_pass(git_attr_get(
repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE, &value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"sub/sub/README.txt", "beep", &value)); "sub/sub/README.txt", "beep"));
cl_assert_equal_s(value, "5"); cl_assert_equal_s(value, "5");
} }
...@@ -64,7 +64,7 @@ void test_attr_repo__get_one(void) ...@@ -64,7 +64,7 @@ void test_attr_repo__get_one(void)
for (scan = test_cases; scan->path != NULL; scan++) { for (scan = test_cases; scan->path != NULL; scan++) {
const char *value; const char *value;
cl_git_pass(git_attr_get(g_repo, 0, scan->path, scan->attr, &value)); cl_git_pass(git_attr_get(&value, g_repo, 0, scan->path, scan->attr));
attr_check_expected(scan->expected, scan->expected_str, value); attr_check_expected(scan->expected, scan->expected_str, value);
} }
...@@ -78,21 +78,21 @@ void test_attr_repo__get_many(void) ...@@ -78,21 +78,21 @@ void test_attr_repo__get_many(void)
const char *names[4] = { "repoattr", "rootattr", "missingattr", "subattr" }; const char *names[4] = { "repoattr", "rootattr", "missingattr", "subattr" };
const char *values[4]; const char *values[4];
cl_git_pass(git_attr_get_many(g_repo, 0, "root_test1", 4, names, values)); cl_git_pass(git_attr_get_many(values, g_repo, 0, "root_test1", 4, names));
cl_assert(GIT_ATTR_TRUE(values[0])); cl_assert(GIT_ATTR_TRUE(values[0]));
cl_assert(GIT_ATTR_TRUE(values[1])); cl_assert(GIT_ATTR_TRUE(values[1]));
cl_assert(GIT_ATTR_UNSPECIFIED(values[2])); cl_assert(GIT_ATTR_UNSPECIFIED(values[2]));
cl_assert(GIT_ATTR_UNSPECIFIED(values[3])); cl_assert(GIT_ATTR_UNSPECIFIED(values[3]));
cl_git_pass(git_attr_get_many(g_repo, 0, "root_test2", 4, names, values)); cl_git_pass(git_attr_get_many(values, g_repo, 0, "root_test2", 4, names));
cl_assert(GIT_ATTR_TRUE(values[0])); cl_assert(GIT_ATTR_TRUE(values[0]));
cl_assert(GIT_ATTR_FALSE(values[1])); cl_assert(GIT_ATTR_FALSE(values[1]));
cl_assert(GIT_ATTR_UNSPECIFIED(values[2])); cl_assert(GIT_ATTR_UNSPECIFIED(values[2]));
cl_assert(GIT_ATTR_UNSPECIFIED(values[3])); cl_assert(GIT_ATTR_UNSPECIFIED(values[3]));
cl_git_pass(git_attr_get_many(g_repo, 0, "sub/subdir_test1", 4, names, values)); cl_git_pass(git_attr_get_many(values, g_repo, 0, "sub/subdir_test1", 4, names));
cl_assert(GIT_ATTR_TRUE(values[0])); cl_assert(GIT_ATTR_TRUE(values[0]));
cl_assert(GIT_ATTR_TRUE(values[1])); cl_assert(GIT_ATTR_TRUE(values[1]));
...@@ -137,19 +137,19 @@ void test_attr_repo__manpage_example(void) ...@@ -137,19 +137,19 @@ void test_attr_repo__manpage_example(void)
{ {
const char *value; const char *value;
cl_git_pass(git_attr_get(g_repo, 0, "sub/abc", "foo", &value)); cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "foo"));
cl_assert(GIT_ATTR_TRUE(value)); cl_assert(GIT_ATTR_TRUE(value));
cl_git_pass(git_attr_get(g_repo, 0, "sub/abc", "bar", &value)); cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "bar"));
cl_assert(GIT_ATTR_UNSPECIFIED(value)); cl_assert(GIT_ATTR_UNSPECIFIED(value));
cl_git_pass(git_attr_get(g_repo, 0, "sub/abc", "baz", &value)); cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "baz"));
cl_assert(GIT_ATTR_FALSE(value)); cl_assert(GIT_ATTR_FALSE(value));
cl_git_pass(git_attr_get(g_repo, 0, "sub/abc", "merge", &value)); cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "merge"));
cl_assert_equal_s("filfre", value); cl_assert_equal_s("filfre", value);
cl_git_pass(git_attr_get(g_repo, 0, "sub/abc", "frotz", &value)); cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "frotz"));
cl_assert(GIT_ATTR_UNSPECIFIED(value)); cl_assert(GIT_ATTR_UNSPECIFIED(value));
} }
...@@ -160,7 +160,7 @@ void test_attr_repo__macros(void) ...@@ -160,7 +160,7 @@ void test_attr_repo__macros(void)
const char *names3[3] = { "macro2", "multi2", "multi3" }; const char *names3[3] = { "macro2", "multi2", "multi3" };
const char *values[5]; const char *values[5];
cl_git_pass(git_attr_get_many(g_repo, 0, "binfile", 5, names, values)); cl_git_pass(git_attr_get_many(values, g_repo, 0, "binfile", 5, names));
cl_assert(GIT_ATTR_TRUE(values[0])); cl_assert(GIT_ATTR_TRUE(values[0]));
cl_assert(GIT_ATTR_TRUE(values[1])); cl_assert(GIT_ATTR_TRUE(values[1]));
...@@ -168,7 +168,7 @@ void test_attr_repo__macros(void) ...@@ -168,7 +168,7 @@ void test_attr_repo__macros(void)
cl_assert(GIT_ATTR_FALSE(values[3])); cl_assert(GIT_ATTR_FALSE(values[3]));
cl_assert(GIT_ATTR_UNSPECIFIED(values[4])); cl_assert(GIT_ATTR_UNSPECIFIED(values[4]));
cl_git_pass(git_attr_get_many(g_repo, 0, "macro_test", 5, names2, values)); cl_git_pass(git_attr_get_many(values, g_repo, 0, "macro_test", 5, names2));
cl_assert(GIT_ATTR_TRUE(values[0])); cl_assert(GIT_ATTR_TRUE(values[0]));
cl_assert(GIT_ATTR_TRUE(values[1])); cl_assert(GIT_ATTR_TRUE(values[1]));
...@@ -176,7 +176,7 @@ void test_attr_repo__macros(void) ...@@ -176,7 +176,7 @@ void test_attr_repo__macros(void)
cl_assert(GIT_ATTR_UNSPECIFIED(values[3])); cl_assert(GIT_ATTR_UNSPECIFIED(values[3]));
cl_assert_equal_s("77", values[4]); cl_assert_equal_s("77", values[4]);
cl_git_pass(git_attr_get_many(g_repo, 0, "macro_test", 3, names3, values)); cl_git_pass(git_attr_get_many(values, g_repo, 0, "macro_test", 3, names3));
cl_assert(GIT_ATTR_TRUE(values[0])); cl_assert(GIT_ATTR_TRUE(values[0]));
cl_assert(GIT_ATTR_FALSE(values[1])); cl_assert(GIT_ATTR_FALSE(values[1]));
...@@ -189,7 +189,7 @@ void test_attr_repo__bad_macros(void) ...@@ -189,7 +189,7 @@ void test_attr_repo__bad_macros(void)
"firstmacro", "secondmacro", "thirdmacro" }; "firstmacro", "secondmacro", "thirdmacro" };
const char *values[6]; const char *values[6];
cl_git_pass(git_attr_get_many(g_repo, 0, "macro_bad", 6, names, values)); cl_git_pass(git_attr_get_many(values, g_repo, 0, "macro_bad", 6, names));
/* these three just confirm that the "mymacro" rule ran */ /* these three just confirm that the "mymacro" rule ran */
cl_assert(GIT_ATTR_UNSPECIFIED(values[0])); cl_assert(GIT_ATTR_UNSPECIFIED(values[0]));
......
...@@ -17,7 +17,7 @@ void test_config_add__to_existing_section(void) ...@@ -17,7 +17,7 @@ void test_config_add__to_existing_section(void)
cl_git_pass(git_config_open_ondisk(&cfg, "config10")); cl_git_pass(git_config_open_ondisk(&cfg, "config10"));
cl_git_pass(git_config_set_int32(cfg, "empty.tmp", 5)); cl_git_pass(git_config_set_int32(cfg, "empty.tmp", 5));
cl_git_pass(git_config_get_int32(cfg, "empty.tmp", &i)); cl_git_pass(git_config_get_int32(&i, cfg, "empty.tmp"));
cl_assert(i == 5); cl_assert(i == 5);
cl_git_pass(git_config_delete(cfg, "empty.tmp")); cl_git_pass(git_config_delete(cfg, "empty.tmp"));
git_config_free(cfg); git_config_free(cfg);
...@@ -30,7 +30,7 @@ void test_config_add__to_new_section(void) ...@@ -30,7 +30,7 @@ void test_config_add__to_new_section(void)
cl_git_pass(git_config_open_ondisk(&cfg, "config10")); cl_git_pass(git_config_open_ondisk(&cfg, "config10"));
cl_git_pass(git_config_set_int32(cfg, "section.tmp", 5)); cl_git_pass(git_config_set_int32(cfg, "section.tmp", 5));
cl_git_pass(git_config_get_int32(cfg, "section.tmp", &i)); cl_git_pass(git_config_get_int32(&i, cfg, "section.tmp"));
cl_assert(i == 5); cl_assert(i == 5);
cl_git_pass(git_config_delete(cfg, "section.tmp")); cl_git_pass(git_config_delete(cfg, "section.tmp"));
git_config_free(cfg); git_config_free(cfg);
......
...@@ -25,9 +25,9 @@ void test_config_new__write_new_config(void) ...@@ -25,9 +25,9 @@ void test_config_new__write_new_config(void)
cl_git_pass(git_config_new(&config)); cl_git_pass(git_config_new(&config));
cl_git_pass(git_config_add_file(config, file, 0)); cl_git_pass(git_config_add_file(config, file, 0));
cl_git_pass(git_config_get_string(config, "color.ui", &out)); cl_git_pass(git_config_get_string(&out, config, "color.ui"));
cl_assert_equal_s(out, "auto"); cl_assert_equal_s(out, "auto");
cl_git_pass(git_config_get_string(config, "core.editor", &out)); cl_git_pass(git_config_get_string(&out, config, "core.editor"));
cl_assert_equal_s(out, "ed"); cl_assert_equal_s(out, "ed");
git_config_free(config); git_config_free(config);
......
...@@ -7,13 +7,13 @@ void test_config_read__simple_read(void) ...@@ -7,13 +7,13 @@ void test_config_read__simple_read(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config0"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config0")));
cl_git_pass(git_config_get_int32(cfg, "core.repositoryformatversion", &i)); cl_git_pass(git_config_get_int32(&i, cfg, "core.repositoryformatversion"));
cl_assert(i == 0); cl_assert(i == 0);
cl_git_pass(git_config_get_bool(cfg, "core.filemode", &i)); cl_git_pass(git_config_get_bool(&i, cfg, "core.filemode"));
cl_assert(i == 1); cl_assert(i == 1);
cl_git_pass(git_config_get_bool(cfg, "core.bare", &i)); cl_git_pass(git_config_get_bool(&i, cfg, "core.bare"));
cl_assert(i == 0); cl_assert(i == 0);
cl_git_pass(git_config_get_bool(cfg, "core.logallrefupdates", &i)); cl_git_pass(git_config_get_bool(&i, cfg, "core.logallrefupdates"));
cl_assert(i == 1); cl_assert(i == 1);
git_config_free(cfg); git_config_free(cfg);
...@@ -27,18 +27,18 @@ void test_config_read__case_sensitive(void) ...@@ -27,18 +27,18 @@ void test_config_read__case_sensitive(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config1"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config1")));
cl_git_pass(git_config_get_string(cfg, "this.that.other", &str)); cl_git_pass(git_config_get_string(&str, cfg, "this.that.other"));
cl_assert_equal_s(str, "true"); cl_assert_equal_s(str, "true");
cl_git_pass(git_config_get_string(cfg, "this.That.other", &str)); cl_git_pass(git_config_get_string(&str, cfg, "this.That.other"));
cl_assert_equal_s(str, "yes"); cl_assert_equal_s(str, "yes");
cl_git_pass(git_config_get_bool(cfg, "this.that.other", &i)); cl_git_pass(git_config_get_bool(&i, cfg, "this.that.other"));
cl_assert(i == 1); cl_assert(i == 1);
cl_git_pass(git_config_get_bool(cfg, "this.That.other", &i)); cl_git_pass(git_config_get_bool(&i, cfg, "this.That.other"));
cl_assert(i == 1); cl_assert(i == 1);
/* This one doesn't exist */ /* This one doesn't exist */
cl_must_fail(git_config_get_bool(cfg, "this.thaT.other", &i)); cl_must_fail(git_config_get_bool(&i, cfg, "this.thaT.other"));
git_config_free(cfg); git_config_free(cfg);
} }
...@@ -54,7 +54,7 @@ void test_config_read__multiline_value(void) ...@@ -54,7 +54,7 @@ void test_config_read__multiline_value(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config2"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config2")));
cl_git_pass(git_config_get_string(cfg, "this.That.and", &str)); cl_git_pass(git_config_get_string(&str, cfg, "this.That.and"));
cl_assert_equal_s(str, "one one one two two three three"); cl_assert_equal_s(str, "one one one two two three three");
git_config_free(cfg); git_config_free(cfg);
...@@ -70,11 +70,11 @@ void test_config_read__subsection_header(void) ...@@ -70,11 +70,11 @@ void test_config_read__subsection_header(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config3"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config3")));
cl_git_pass(git_config_get_string(cfg, "section.subsection.var", &str)); cl_git_pass(git_config_get_string(&str, cfg, "section.subsection.var"));
cl_assert_equal_s(str, "hello"); cl_assert_equal_s(str, "hello");
/* The subsection is transformed to lower-case */ /* The subsection is transformed to lower-case */
cl_must_fail(git_config_get_string(cfg, "section.subSectIon.var", &str)); cl_must_fail(git_config_get_string(&str, cfg, "section.subSectIon.var"));
git_config_free(cfg); git_config_free(cfg);
} }
...@@ -87,10 +87,10 @@ void test_config_read__lone_variable(void) ...@@ -87,10 +87,10 @@ void test_config_read__lone_variable(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config4"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config4")));
cl_git_pass(git_config_get_string(cfg, "some.section.variable", &str)); cl_git_pass(git_config_get_string(&str, cfg, "some.section.variable"));
cl_assert(str == NULL); cl_assert(str == NULL);
cl_git_pass(git_config_get_bool(cfg, "some.section.variable", &i)); cl_git_pass(git_config_get_bool(&i, cfg, "some.section.variable"));
cl_assert(i == 1); cl_assert(i == 1);
git_config_free(cfg); git_config_free(cfg);
...@@ -103,25 +103,25 @@ void test_config_read__number_suffixes(void) ...@@ -103,25 +103,25 @@ void test_config_read__number_suffixes(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config5"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config5")));
cl_git_pass(git_config_get_int64(cfg, "number.simple", &i)); cl_git_pass(git_config_get_int64(&i, cfg, "number.simple"));
cl_assert(i == 1); cl_assert(i == 1);
cl_git_pass(git_config_get_int64(cfg, "number.k", &i)); cl_git_pass(git_config_get_int64(&i, cfg, "number.k"));
cl_assert(i == 1 * 1024); cl_assert(i == 1 * 1024);
cl_git_pass(git_config_get_int64(cfg, "number.kk", &i)); cl_git_pass(git_config_get_int64(&i, cfg, "number.kk"));
cl_assert(i == 1 * 1024); cl_assert(i == 1 * 1024);
cl_git_pass(git_config_get_int64(cfg, "number.m", &i)); cl_git_pass(git_config_get_int64(&i, cfg, "number.m"));
cl_assert(i == 1 * 1024 * 1024); cl_assert(i == 1 * 1024 * 1024);
cl_git_pass(git_config_get_int64(cfg, "number.mm", &i)); cl_git_pass(git_config_get_int64(&i, cfg, "number.mm"));
cl_assert(i == 1 * 1024 * 1024); cl_assert(i == 1 * 1024 * 1024);
cl_git_pass(git_config_get_int64(cfg, "number.g", &i)); cl_git_pass(git_config_get_int64(&i, cfg, "number.g"));
cl_assert(i == 1 * 1024 * 1024 * 1024); cl_assert(i == 1 * 1024 * 1024 * 1024);
cl_git_pass(git_config_get_int64(cfg, "number.gg", &i)); cl_git_pass(git_config_get_int64(&i, cfg, "number.gg"));
cl_assert(i == 1 * 1024 * 1024 * 1024); cl_assert(i == 1 * 1024 * 1024 * 1024);
git_config_free(cfg); git_config_free(cfg);
...@@ -134,10 +134,10 @@ void test_config_read__blank_lines(void) ...@@ -134,10 +134,10 @@ void test_config_read__blank_lines(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config6"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config6")));
cl_git_pass(git_config_get_bool(cfg, "valid.subsection.something", &i)); cl_git_pass(git_config_get_bool(&i, cfg, "valid.subsection.something"));
cl_assert(i == 1); cl_assert(i == 1);
cl_git_pass(git_config_get_bool(cfg, "something.else.something", &i)); cl_git_pass(git_config_get_bool(&i, cfg, "something.else.something"));
cl_assert(i == 0); cl_assert(i == 0);
git_config_free(cfg); git_config_free(cfg);
...@@ -170,10 +170,10 @@ void test_config_read__prefixes(void) ...@@ -170,10 +170,10 @@ void test_config_read__prefixes(void)
const char *str; const char *str;
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config9"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config9")));
cl_git_pass(git_config_get_string(cfg, "remote.ab.url", &str)); cl_git_pass(git_config_get_string(&str, cfg, "remote.ab.url"));
cl_assert_equal_s(str, "http://example.com/git/ab"); cl_assert_equal_s(str, "http://example.com/git/ab");
cl_git_pass(git_config_get_string(cfg, "remote.abba.url", &str)); cl_git_pass(git_config_get_string(&str, cfg, "remote.abba.url"));
cl_assert_equal_s(str, "http://example.com/git/abba"); cl_assert_equal_s(str, "http://example.com/git/abba");
git_config_free(cfg); git_config_free(cfg);
...@@ -185,7 +185,7 @@ void test_config_read__escaping_quotes(void) ...@@ -185,7 +185,7 @@ void test_config_read__escaping_quotes(void)
const char *str; const char *str;
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config13"))); cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config13")));
cl_git_pass(git_config_get_string(cfg, "core.editor", &str)); cl_git_pass(git_config_get_string(&str, cfg, "core.editor"));
cl_assert(strcmp(str, "\"C:/Program Files/Nonsense/bah.exe\" \"--some option\"") == 0); cl_assert(strcmp(str, "\"C:/Program Files/Nonsense/bah.exe\" \"--some option\"") == 0);
git_config_free(cfg); git_config_free(cfg);
......
...@@ -32,8 +32,8 @@ void test_config_stress__dont_break_on_invalid_input(void) ...@@ -32,8 +32,8 @@ void test_config_stress__dont_break_on_invalid_input(void)
cl_git_pass(git_config_new(&config)); cl_git_pass(git_config_new(&config));
cl_git_pass(git_config_add_file(config, file, 0)); cl_git_pass(git_config_add_file(config, file, 0));
cl_git_pass(git_config_get_string(config, "color.ui", &color)); cl_git_pass(git_config_get_string(&color, config, "color.ui"));
cl_git_pass(git_config_get_string(config, "core.editor", &editor)); cl_git_pass(git_config_get_string(&editor, config, "core.editor"));
git_config_free(config); git_config_free(config);
} }
...@@ -48,13 +48,13 @@ void test_config_stress__comments(void) ...@@ -48,13 +48,13 @@ void test_config_stress__comments(void)
cl_git_pass(git_config_new(&config)); cl_git_pass(git_config_new(&config));
cl_git_pass(git_config_add_file(config, file, 0)); cl_git_pass(git_config_add_file(config, file, 0));
cl_git_pass(git_config_get_string(config, "some.section.other", &str)); cl_git_pass(git_config_get_string(&str, config, "some.section.other"));
cl_assert(!strcmp(str, "hello! \" ; ; ; ")); cl_assert(!strcmp(str, "hello! \" ; ; ; "));
cl_git_pass(git_config_get_string(config, "some.section.multi", &str)); cl_git_pass(git_config_get_string(&str, config, "some.section.multi"));
cl_assert(!strcmp(str, "hi, this is a ; multiline comment # with ;\n special chars and other stuff !@#")); cl_assert(!strcmp(str, "hi, this is a ; multiline comment # with ;\n special chars and other stuff !@#"));
cl_git_pass(git_config_get_string(config, "some.section.back", &str)); cl_git_pass(git_config_get_string(&str, config, "some.section.back"));
cl_assert(!strcmp(str, "this is \ba phrase")); cl_assert(!strcmp(str, "this is \ba phrase"));
git_config_free(config); git_config_free(config);
......
...@@ -22,7 +22,7 @@ void test_config_write__replace_value(void) ...@@ -22,7 +22,7 @@ void test_config_write__replace_value(void)
git_config_free(cfg); git_config_free(cfg);
cl_git_pass(git_config_open_ondisk(&cfg, "config9")); cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
cl_git_pass(git_config_get_int32(cfg, "core.dummy", &i)); cl_git_pass(git_config_get_int32(&i, cfg, "core.dummy"));
cl_assert(i == 5); cl_assert(i == 5);
git_config_free(cfg); git_config_free(cfg);
...@@ -35,12 +35,12 @@ void test_config_write__replace_value(void) ...@@ -35,12 +35,12 @@ void test_config_write__replace_value(void)
git_config_free(cfg); git_config_free(cfg);
cl_git_pass(git_config_open_ondisk(&cfg, "config9")); cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
cl_git_pass(git_config_get_int64(cfg, "core.verylong", &l)); cl_git_pass(git_config_get_int64(&l, cfg, "core.verylong"));
cl_assert(l == expected); cl_assert(l == expected);
git_config_free(cfg); git_config_free(cfg);
cl_git_pass(git_config_open_ondisk(&cfg, "config9")); cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
cl_must_fail(git_config_get_int32(cfg, "core.verylong", &i)); cl_must_fail(git_config_get_int32(&i, cfg, "core.verylong"));
git_config_free(cfg); git_config_free(cfg);
cl_git_pass(git_config_open_ondisk(&cfg, "config9")); cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
...@@ -62,7 +62,7 @@ void test_config_write__delete_value(void) ...@@ -62,7 +62,7 @@ void test_config_write__delete_value(void)
git_config_free(cfg); git_config_free(cfg);
cl_git_pass(git_config_open_ondisk(&cfg, "config9")); cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
cl_assert(git_config_get_int32(cfg, "core.dummy", &i) == GIT_ENOTFOUND); cl_assert(git_config_get_int32(&i, cfg, "core.dummy") == GIT_ENOTFOUND);
cl_git_pass(git_config_set_int32(cfg, "core.dummy", 1)); cl_git_pass(git_config_set_int32(cfg, "core.dummy", 1));
git_config_free(cfg); git_config_free(cfg);
} }
...@@ -77,7 +77,7 @@ void test_config_write__write_subsection(void) ...@@ -77,7 +77,7 @@ void test_config_write__write_subsection(void)
git_config_free(cfg); git_config_free(cfg);
cl_git_pass(git_config_open_ondisk(&cfg, "config9")); cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
cl_git_pass(git_config_get_string(cfg, "my.own.var", &str)); cl_git_pass(git_config_get_string(&str, cfg, "my.own.var"));
cl_git_pass(strcmp(str, "works")); cl_git_pass(strcmp(str, "works"));
git_config_free(cfg); git_config_free(cfg);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment