summaryrefslogtreecommitdiff
path: root/source/tests
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-25 02:54:40 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-25 02:54:40 +0200
commit2081f2df729a5dd5e6af1f24508ad4be8a632676 (patch)
treea49b2ed0d837773b8cdc735ad75e502b63fbf886 /source/tests
parent7ca3f68ac2aa6ee7cee632f8cd72cc3ef6c4faa9 (diff)
downloadkit-2081f2df729a5dd5e6af1f24508ad4be8a632676.zip
Add default data path
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");