summaryrefslogtreecommitdiff
path: root/src/test/test-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-util.c')
-rw-r--r--src/test/test-util.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c
index 80425ca61a..f8e42f3a55 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -843,11 +843,27 @@ static void test_is_valid_documentation_url(void) {
}
static void test_file_in_same_dir(void) {
- assert_se(streq(file_in_same_dir("/", "a"), "/a"));
- assert_se(streq(file_in_same_dir("/", "/a"), "/a"));
- assert_se(streq(file_in_same_dir("", "a"), "a"));
- assert_se(streq(file_in_same_dir("a/", "a"), "a/a"));
- assert_se(streq(file_in_same_dir("bar/foo", "bar"), "bar/bar"));
+ char *t;
+
+ t = file_in_same_dir("/", "a");
+ assert_se(streq(t, "/a"));
+ free(t);
+
+ t = file_in_same_dir("/", "/a");
+ assert_se(streq(t, "/a"));
+ free(t);
+
+ t = file_in_same_dir("", "a");
+ assert_se(streq(t, "a"));
+ free(t);
+
+ t = file_in_same_dir("a/", "a");
+ assert_se(streq(t, "a/a"));
+ free(t);
+
+ t = file_in_same_dir("bar/foo", "bar");
+ assert_se(streq(t, "bar/bar"));
+ free(t);
}
static void test_endswith(void) {
@@ -1239,11 +1255,13 @@ static void test_unquote_many_words(void) {
assert_se(unquote_many_words(&p, &a, NULL) == 1);
assert_se(p == original+7);
assert_se(streq_ptr(a, "foobar"));
+ free(a);
p = original = " foobar ";
assert_se(unquote_many_words(&p, &a, NULL) == 1);
assert_se(p == original+15);
assert_se(streq_ptr(a, "foobar"));
+ free(a);
}
int main(int argc, char *argv[]) {