summaryrefslogtreecommitdiff
path: root/tests-clar/attr
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-04-13 10:42:00 -0700
committerRussell Belfer <rb@github.com>2012-04-17 10:35:11 -0700
commit1a6e8f8a54eea1159a950cd8a49cedae3699ff9a (patch)
treee73489417ecc46ef30acf7a9ac3107e6ebd43ba3 /tests-clar/attr
parentdbeca7969871a00826d662e68cfb4039e77c619b (diff)
downloadlibgit2-1a6e8f8a54eea1159a950cd8a49cedae3699ff9a.tar.gz
Update clar and remove old helpers
This updates to the latest clar which includes the helpers `cl_assert_equal_s` and `cl_assert_equal_i`. Convert the code over to use those and remove the old libgit2-only helpers.
Diffstat (limited to 'tests-clar/attr')
-rw-r--r--tests-clar/attr/attr_expect.h2
-rw-r--r--tests-clar/attr/file.c84
-rw-r--r--tests-clar/attr/lookup.c10
-rw-r--r--tests-clar/attr/repo.c10
4 files changed, 53 insertions, 53 deletions
diff --git a/tests-clar/attr/attr_expect.h b/tests-clar/attr/attr_expect.h
index b064eac65..df1e1044b 100644
--- a/tests-clar/attr/attr_expect.h
+++ b/tests-clar/attr/attr_expect.h
@@ -34,7 +34,7 @@ GIT_INLINE(void) attr_check_expected(
break;
case EXPECT_STRING:
- cl_assert_strequal(expected_str, value);
+ cl_assert_equal_s(expected_str, value);
break;
}
}
diff --git a/tests-clar/attr/file.c b/tests-clar/attr/file.c
index 6aeaa5135..7fede5025 100644
--- a/tests-clar/attr/file.c
+++ b/tests-clar/attr/file.c
@@ -13,19 +13,19 @@ void test_attr_file__simple_read(void)
cl_git_pass(git_attr_file__new(&file));
cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr0"), file));
- cl_assert_strequal(cl_fixture("attr/attr0"), file->path);
+ cl_assert_equal_s(cl_fixture("attr/attr0"), file->path);
cl_assert(file->rules.length == 1);
rule = get_rule(0);
cl_assert(rule != NULL);
- cl_assert_strequal("*", rule->match.pattern);
+ cl_assert_equal_s("*", rule->match.pattern);
cl_assert(rule->match.length == 1);
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_HASWILD) != 0);
cl_assert(rule->assigns.length == 1);
assign = get_assign(rule, 0);
cl_assert(assign != NULL);
- cl_assert_strequal("binary", assign->name);
+ cl_assert_equal_s("binary", assign->name);
cl_assert(GIT_ATTR_TRUE(assign->value));
cl_assert(!assign->is_allocated);
@@ -40,7 +40,7 @@ void test_attr_file__match_variants(void)
cl_git_pass(git_attr_file__new(&file));
cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr1"), file));
- cl_assert_strequal(cl_fixture("attr/attr1"), file->path);
+ cl_assert_equal_s(cl_fixture("attr/attr1"), file->path);
cl_assert(file->rules.length == 10);
/* let's do a thorough check of this rule, then just verify
@@ -48,53 +48,53 @@ void test_attr_file__match_variants(void)
*/
rule = get_rule(0);
cl_assert(rule);
- cl_assert_strequal("pat0", rule->match.pattern);
+ cl_assert_equal_s("pat0", rule->match.pattern);
cl_assert(rule->match.length == strlen("pat0"));
cl_assert(rule->match.flags == 0);
cl_assert(rule->assigns.length == 1);
assign = get_assign(rule,0);
- cl_assert_strequal("attr0", assign->name);
+ cl_assert_equal_s("attr0", assign->name);
cl_assert(assign->name_hash == git_attr_file__name_hash(assign->name));
cl_assert(GIT_ATTR_TRUE(assign->value));
cl_assert(!assign->is_allocated);
rule = get_rule(1);
- cl_assert_strequal("pat1", rule->match.pattern);
+ cl_assert_equal_s("pat1", rule->match.pattern);
cl_assert(rule->match.length == strlen("pat1"));
cl_assert(rule->match.flags == GIT_ATTR_FNMATCH_NEGATIVE);
rule = get_rule(2);
- cl_assert_strequal("pat2", rule->match.pattern);
+ cl_assert_equal_s("pat2", rule->match.pattern);
cl_assert(rule->match.length == strlen("pat2"));
cl_assert(rule->match.flags == GIT_ATTR_FNMATCH_DIRECTORY);
rule = get_rule(3);
- cl_assert_strequal("pat3dir/pat3file", rule->match.pattern);
+ cl_assert_equal_s("pat3dir/pat3file", rule->match.pattern);
cl_assert(rule->match.flags == GIT_ATTR_FNMATCH_FULLPATH);
rule = get_rule(4);
- cl_assert_strequal("pat4.*", rule->match.pattern);
+ cl_assert_equal_s("pat4.*", rule->match.pattern);
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_HASWILD) != 0);
rule = get_rule(5);
- cl_assert_strequal("*.pat5", rule->match.pattern);
+ cl_assert_equal_s("*.pat5", rule->match.pattern);
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_HASWILD) != 0);
rule = get_rule(7);
- cl_assert_strequal("pat7[a-e]??[xyz]", rule->match.pattern);
+ cl_assert_equal_s("pat7[a-e]??[xyz]", rule->match.pattern);
cl_assert(rule->assigns.length == 1);
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_HASWILD) != 0);
assign = get_assign(rule,0);
- cl_assert_strequal("attr7", assign->name);
+ cl_assert_equal_s("attr7", assign->name);
cl_assert(GIT_ATTR_TRUE(assign->value));
rule = get_rule(8);
- cl_assert_strequal("pat8 with spaces", rule->match.pattern);
+ cl_assert_equal_s("pat8 with spaces", rule->match.pattern);
cl_assert(rule->match.length == strlen("pat8 with spaces"));
cl_assert(rule->match.flags == 0);
rule = get_rule(9);
- cl_assert_strequal("pat9", rule->match.pattern);
+ cl_assert_equal_s("pat9", rule->match.pattern);
git_attr_file__free(file);
}
@@ -111,9 +111,9 @@ static void check_one_assign(
git_attr_rule *rule = get_rule(rule_idx);
git_attr_assignment *assign = get_assign(rule, assign_idx);
- cl_assert_strequal(pattern, rule->match.pattern);
+ cl_assert_equal_s(pattern, rule->match.pattern);
cl_assert(rule->assigns.length == 1);
- cl_assert_strequal(name, assign->name);
+ cl_assert_equal_s(name, assign->name);
cl_assert(assign->name_hash == git_attr_file__name_hash(assign->name));
attr_check_expected(expected, expected_str, assign->value);
@@ -127,7 +127,7 @@ void test_attr_file__assign_variants(void)
cl_git_pass(git_attr_file__new(&file));
cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr2"), file));
- cl_assert_strequal(cl_fixture("attr/attr2"), file->path);
+ cl_assert_equal_s(cl_fixture("attr/attr2"), file->path);
cl_assert(file->rules.length == 11);
check_one_assign(file, 0, 0, "pat0", "simple", EXPECT_TRUE, NULL);
@@ -140,45 +140,45 @@ void test_attr_file__assign_variants(void)
check_one_assign(file, 7, 0, "pat6", "negempty", EXPECT_FALSE, NULL);
rule = get_rule(8);
- cl_assert_strequal("pat7", rule->match.pattern);
+ cl_assert_equal_s("pat7", rule->match.pattern);
cl_assert(rule->assigns.length == 5);
/* assignments will be sorted by hash value, so we have to do
* lookups by search instead of by position
*/
assign = git_attr_rule__lookup_assignment(rule, "multiple");
cl_assert(assign);
- cl_assert_strequal("multiple", assign->name);
+ cl_assert_equal_s("multiple", assign->name);
cl_assert(GIT_ATTR_TRUE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "single");
cl_assert(assign);
- cl_assert_strequal("single", assign->name);
+ cl_assert_equal_s("single", assign->name);
cl_assert(GIT_ATTR_FALSE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "values");
cl_assert(assign);
- cl_assert_strequal("values", assign->name);
- cl_assert_strequal("1", assign->value);
+ cl_assert_equal_s("values", assign->name);
+ cl_assert_equal_s("1", assign->value);
assign = git_attr_rule__lookup_assignment(rule, "also");
cl_assert(assign);
- cl_assert_strequal("also", assign->name);
- cl_assert_strequal("a-really-long-value/*", assign->value);
+ cl_assert_equal_s("also", assign->name);
+ cl_assert_equal_s("a-really-long-value/*", assign->value);
assign = git_attr_rule__lookup_assignment(rule, "happy");
cl_assert(assign);
- cl_assert_strequal("happy", assign->name);
- cl_assert_strequal("yes!", assign->value);
+ cl_assert_equal_s("happy", assign->name);
+ cl_assert_equal_s("yes!", assign->value);
assign = git_attr_rule__lookup_assignment(rule, "other");
cl_assert(!assign);
rule = get_rule(9);
- cl_assert_strequal("pat8", rule->match.pattern);
+ cl_assert_equal_s("pat8", rule->match.pattern);
cl_assert(rule->assigns.length == 2);
assign = git_attr_rule__lookup_assignment(rule, "again");
cl_assert(assign);
- cl_assert_strequal("again", assign->name);
+ cl_assert_equal_s("again", assign->name);
cl_assert(GIT_ATTR_TRUE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "another");
cl_assert(assign);
- cl_assert_strequal("another", assign->name);
- cl_assert_strequal("12321", assign->value);
+ cl_assert_equal_s("another", assign->name);
+ cl_assert_equal_s("12321", assign->value);
check_one_assign(file, 10, 0, "pat9", "at-eof", EXPECT_FALSE, NULL);
@@ -193,37 +193,37 @@ void test_attr_file__check_attr_examples(void)
cl_git_pass(git_attr_file__new(&file));
cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr3"), file));
- cl_assert_strequal(cl_fixture("attr/attr3"), file->path);
+ cl_assert_equal_s(cl_fixture("attr/attr3"), file->path);
cl_assert(file->rules.length == 3);
rule = get_rule(0);
- cl_assert_strequal("*.java", rule->match.pattern);
+ cl_assert_equal_s("*.java", rule->match.pattern);
cl_assert(rule->assigns.length == 3);
assign = git_attr_rule__lookup_assignment(rule, "diff");
- cl_assert_strequal("diff", assign->name);
- cl_assert_strequal("java", assign->value);
+ cl_assert_equal_s("diff", assign->name);
+ cl_assert_equal_s("java", assign->value);
assign = git_attr_rule__lookup_assignment(rule, "crlf");
- cl_assert_strequal("crlf", assign->name);
+ cl_assert_equal_s("crlf", assign->name);
cl_assert(GIT_ATTR_FALSE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "myAttr");
- cl_assert_strequal("myAttr", assign->name);
+ cl_assert_equal_s("myAttr", assign->name);
cl_assert(GIT_ATTR_TRUE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "missing");
cl_assert(assign == NULL);
rule = get_rule(1);
- cl_assert_strequal("NoMyAttr.java", rule->match.pattern);
+ cl_assert_equal_s("NoMyAttr.java", rule->match.pattern);
cl_assert(rule->assigns.length == 1);
assign = get_assign(rule, 0);
- cl_assert_strequal("myAttr", assign->name);
+ cl_assert_equal_s("myAttr", assign->name);
cl_assert(assign->value == NULL);
rule = get_rule(2);
- cl_assert_strequal("README", rule->match.pattern);
+ cl_assert_equal_s("README", rule->match.pattern);
cl_assert(rule->assigns.length == 1);
assign = get_assign(rule, 0);
- cl_assert_strequal("caveat", assign->name);
- cl_assert_strequal("unspecified", assign->value);
+ cl_assert_equal_s("caveat", assign->name);
+ cl_assert_equal_s("unspecified", assign->value);
git_attr_file__free(file);
}
diff --git a/tests-clar/attr/lookup.c b/tests-clar/attr/lookup.c
index 19396182e..4ce80e947 100644
--- a/tests-clar/attr/lookup.c
+++ b/tests-clar/attr/lookup.c
@@ -11,12 +11,12 @@ void test_attr_lookup__simple(void)
cl_git_pass(git_attr_file__new(&file));
cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr0"), file));
- cl_assert_strequal(cl_fixture("attr/attr0"), file->path);
+ cl_assert_equal_s(cl_fixture("attr/attr0"), file->path);
cl_assert(file->rules.length == 1);
cl_git_pass(git_attr_path__init(&path, "test", NULL));
- cl_assert_strequal("test", path.path);
- cl_assert_strequal("test", path.basename);
+ cl_assert_equal_s("test", path.path);
+ cl_assert_equal_s("test", path.basename);
cl_assert(!path.is_dir);
cl_git_pass(git_attr_file__lookup_one(file,&path,"binary",&value));
@@ -129,11 +129,11 @@ void test_attr_lookup__match_variants(void)
cl_git_pass(git_attr_file__new(&file));
cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr1"), file));
- cl_assert_strequal(cl_fixture("attr/attr1"), file->path);
+ cl_assert_equal_s(cl_fixture("attr/attr1"), file->path);
cl_assert(file->rules.length == 10);
cl_git_pass(git_attr_path__init(&path, "/testing/for/pat0", NULL));
- cl_assert_strequal("pat0", path.basename);
+ cl_assert_equal_s("pat0", path.basename);
run_test_cases(file, cases, 0);
run_test_cases(file, dir_cases, 1);
diff --git a/tests-clar/attr/repo.c b/tests-clar/attr/repo.c
index 5ff33d14a..6dc13aa9d 100644
--- a/tests-clar/attr/repo.c
+++ b/tests-clar/attr/repo.c
@@ -101,7 +101,7 @@ void test_attr_repo__get_many(void)
cl_assert(GIT_ATTR_TRUE(values[0]));
cl_assert(GIT_ATTR_TRUE(values[1]));
cl_assert(GIT_ATTR_UNSPECIFIED(values[2]));
- cl_assert_strequal("yes", values[3]);
+ cl_assert_equal_s("yes", values[3]);
}
static int count_attrs(
@@ -150,7 +150,7 @@ void test_attr_repo__manpage_example(void)
cl_assert(GIT_ATTR_FALSE(value));
cl_git_pass(git_attr_get(g_repo, "sub/abc", "merge", &value));
- cl_assert_strequal("filfre", value);
+ cl_assert_equal_s("filfre", value);
cl_git_pass(git_attr_get(g_repo, "sub/abc", "frotz", &value));
cl_assert(GIT_ATTR_UNSPECIFIED(value));
@@ -177,13 +177,13 @@ void test_attr_repo__macros(void)
cl_assert(GIT_ATTR_TRUE(values[1]));
cl_assert(GIT_ATTR_FALSE(values[2]));
cl_assert(GIT_ATTR_UNSPECIFIED(values[3]));
- cl_assert_strequal("77", values[4]);
+ cl_assert_equal_s("77", values[4]);
cl_git_pass(git_attr_get_many(g_repo, "macro_test", 3, names3, values));
cl_assert(GIT_ATTR_TRUE(values[0]));
cl_assert(GIT_ATTR_FALSE(values[1]));
- cl_assert_strequal("answer", values[2]);
+ cl_assert_equal_s("answer", values[2]);
}
void test_attr_repo__bad_macros(void)
@@ -222,7 +222,7 @@ void test_attr_repo__bad_macros(void)
* -firstmacro secondmacro="hahaha" thirdmacro
*/
cl_assert(GIT_ATTR_FALSE(values[3]));
- cl_assert_strequal("hahaha", values[4]);
+ cl_assert_equal_s("hahaha", values[4]);
cl_assert(GIT_ATTR_TRUE(values[5]));
}