summaryrefslogtreecommitdiff
path: root/source/tests
diff options
context:
space:
mode:
Diffstat (limited to 'source/tests')
-rw-r--r--source/tests/file.test.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/source/tests/file.test.c b/source/tests/file.test.c
index 9ec51bf..6faef1b 100644
--- a/source/tests/file.test.c
+++ b/source/tests/file.test.c
@@ -14,7 +14,8 @@ TEST("path cache") {
str_builder_t expected =
#if defined(_WIN32) && !defined(__CYGWIN__)
- path_join(WRAP_STR(user), SZ("AppData" PATH_DELIM "Local"),
+ path_join(WRAP_STR(user),
+ SZ("AppData" PATH_DELIM "Local" PATH_DELIM "Temp"),
NULL);
#elif defined(__APPLE__)
path_join(WRAP_STR(user), SZ("Library" PATH_DELIM "Caches"),
@@ -30,6 +31,32 @@ TEST("path cache") {
DA_DESTROY(expected);
}
+TEST("path data") {
+ str_builder_t user = path_user(NULL);
+ str_builder_t data = path_data(NULL);
+
+ DA_RESIZE(data, data.size + 1);
+ data.values[data.size - 1] = '\0';
+ DA_RESIZE(data, data.size - 1);
+
+ str_builder_t expected =
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ path_join(WRAP_STR(user), SZ("AppData" PATH_DELIM "Local"),
+ NULL);
+#elif defined(__APPLE__)
+ path_join(WRAP_STR(user), SZ("Library"), NULL);
+#else
+ path_join(WRAP_STR(user), SZ(".local" PATH_DELIM "share"),
+ NULL);
+#endif
+
+ REQUIRE(AR_EQUAL(data, expected));
+
+ DA_DESTROY(user);
+ DA_DESTROY(data);
+ DA_DESTROY(expected);
+}
+
TEST("path normalize one") {
str_t foo = SZ("foo/bar/../baz");
str_t foo_norm = SZ("foo" PATH_DELIM "baz");