summaryrefslogtreecommitdiff
path: root/source/tests
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-08 13:32:54 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-08 13:32:54 +0200
commitedad17b52d6558a5559f02cddcb66158193fe164 (patch)
tree5a31dd428c1b81f092bb1fb311368971d4fe5a2b /source/tests
parent0296a6018de8fa4d6fa1496550f84465741dfd26 (diff)
downloadkit-edad17b52d6558a5559f02cddcb66158193fe164.zip
refactor allocs
Diffstat (limited to 'source/tests')
-rw-r--r--source/tests/file.test.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/source/tests/file.test.c b/source/tests/file.test.c
index e72df83..859de86 100644
--- a/source/tests/file.test.c
+++ b/source/tests/file.test.c
@@ -6,10 +6,8 @@
#include "../kit_test/test.h"
TEST("file path cache") {
- kit_allocator_t alloc = kit_alloc_default();
-
- string_t user = path_user(alloc);
- string_t cache = path_cache(alloc);
+ string_t user = path_user(NULL);
+ string_t cache = path_cache(NULL);
DA_RESIZE(cache, cache.size + 1);
cache.values[cache.size - 1] = '\0';
@@ -18,12 +16,12 @@ TEST("file path cache") {
string_t expected =
#if defined(_WIN32) && !defined(__CYGWIN__)
path_join(WRAP_STR(user), SZ("AppData" PATH_DELIM "Local"),
- alloc);
+ NULL);
#elif defined(__APPLE__)
path_join(WRAP_STR(user), SZ("Library" PATH_DELIM "Caches"),
- alloc);
+ NULL);
#else
- path_join(WRAP_STR(user), SZ(".cache"), alloc);
+ path_join(WRAP_STR(user), SZ(".cache"), NULL);
#endif
REQUIRE(AR_EQUAL(cache, expected));
@@ -37,7 +35,7 @@ TEST("file path normalize one") {
str_t foo = SZ("foo/bar/../baz");
str_t foo_norm = SZ("foo" PATH_DELIM "baz");
- string_t bar = path_norm(foo, kit_alloc_default());
+ string_t bar = path_norm(foo, NULL);
REQUIRE(AR_EQUAL(foo_norm, bar));
@@ -48,7 +46,7 @@ TEST("file path normalize two") {
str_t foo = SZ("foo/bar/../../baz");
str_t foo_norm = SZ("baz");
- string_t bar = path_norm(foo, kit_alloc_default());
+ string_t bar = path_norm(foo, NULL);
REQUIRE(AR_EQUAL(foo_norm, bar));
@@ -59,7 +57,7 @@ TEST("file path normalize parent") {
str_t foo = SZ("../baz");
str_t foo_norm = SZ(".." PATH_DELIM "baz");
- string_t bar = path_norm(foo, kit_alloc_default());
+ string_t bar = path_norm(foo, NULL);
REQUIRE(AR_EQUAL(foo_norm, bar));
@@ -70,7 +68,7 @@ TEST("file path normalize double parent") {
str_t foo = SZ("foo/../../baz");
str_t foo_norm = SZ(".." PATH_DELIM "baz");
- string_t bar = path_norm(foo, kit_alloc_default());
+ string_t bar = path_norm(foo, NULL);
REQUIRE(AR_EQUAL(foo_norm, bar));
@@ -81,7 +79,7 @@ TEST("file path normalize windows delim") {
str_t foo = SZ("foo\\bar\\..\\baz");
str_t foo_norm = SZ("foo" PATH_DELIM "baz");
- string_t bar = path_norm(foo, kit_alloc_default());
+ string_t bar = path_norm(foo, NULL);
REQUIRE(AR_EQUAL(foo_norm, bar));
@@ -93,7 +91,7 @@ TEST("file path join no delim") {
str_t bar = SZ("bar");
str_t joined = SZ("foo" PATH_DELIM "bar");
- string_t foobar = path_join(foo, bar, kit_alloc_default());
+ string_t foobar = path_join(foo, bar, NULL);
REQUIRE(AR_EQUAL(joined, foobar));
@@ -105,7 +103,7 @@ TEST("file path join delim left") {
str_t bar = SZ("bar");
str_t joined = SZ("foo" PATH_DELIM "bar");
- string_t foobar = path_join(foo, bar, kit_alloc_default());
+ string_t foobar = path_join(foo, bar, NULL);
REQUIRE(AR_EQUAL(joined, foobar));
@@ -117,7 +115,7 @@ TEST("file path join delim right") {
str_t bar = SZ("/bar");
str_t joined = SZ("foo" PATH_DELIM "bar");
- string_t foobar = path_join(foo, bar, kit_alloc_default());
+ string_t foobar = path_join(foo, bar, NULL);
REQUIRE(AR_EQUAL(joined, foobar));
@@ -129,7 +127,7 @@ TEST("file path join delim both") {
str_t bar = SZ("/bar");
str_t joined = SZ("foo" PATH_DELIM "bar");
- string_t foobar = path_join(foo, bar, kit_alloc_default());
+ string_t foobar = path_join(foo, bar, NULL);
REQUIRE(AR_EQUAL(joined, foobar));
@@ -137,7 +135,7 @@ TEST("file path join delim both") {
}
TEST("file path user") {
- string_t user = path_user(kit_alloc_default());
+ string_t user = path_user(NULL);
REQUIRE(user.size > 0);