summaryrefslogtreecommitdiffstats
path: root/test/lilv_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/lilv_test.c')
-rw-r--r--test/lilv_test.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lilv_test.c b/test/lilv_test.c
index c8c565a..1a02889 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -1421,6 +1421,16 @@ test_string(void)
TEST_ASSERT(!strcmp((s = lilv_path_join("/a/", "/b")), "/a/b"));
TEST_ASSERT(!strcmp((s = lilv_path_join("/a/", "b")), "/a/b"));
+ setenv("LILV_TEST_1", "test", 1);
+ char* home_foo = lilv_strjoin(getenv("HOME"), "/foo", NULL);
+ TEST_ASSERT(!strcmp((s = lilv_expand("$LILV_TEST_1")), "test"));
+ TEST_ASSERT(!strcmp((s = lilv_expand("~")), getenv("HOME")));
+ TEST_ASSERT(!strcmp((s = lilv_expand("~foo")), "~foo"));
+ TEST_ASSERT(!strcmp((s = lilv_expand("~/foo")), home_foo));
+ TEST_ASSERT(!strcmp((s = lilv_expand("$NOT_A_VAR")), "$NOT_A_VAR"));
+ free(home_foo);
+ unsetenv("LILV_TEST_1");
+
return 1;
}