From 90e4da9473ee2fc6419b7821274ec102219551f9 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Wed, 22 Nov 2023 21:08:08 +0100 Subject: Test: Add test case for realpath() --- userland/test/test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/userland/test/test.c b/userland/test/test.c index 2e4c83d..a8c20dc 100644 --- a/userland/test/test.c +++ b/userland/test/test.c @@ -718,6 +718,23 @@ void getline_test(void) { dbgln("getline TEST PASSED"); } +void realpath_test(void) { + dbgln("realpath TEST"); + { + chdir("/"); + char path[256]; + realpath(".", path); + assert(0 == strcmp(path, "/")); + + realpath("..", path); + assert(0 == strcmp(path, "/")); + + realpath("test", path); + assert(0 == strcmp(path, "/test")); + } + dbgln("realpath TEST PASSED"); +} + int main(void) { dbgln("START"); malloc_test(); @@ -756,6 +773,7 @@ int main(void) { basename_test(); dirname_test(); getline_test(); + realpath_test(); // TODO: Add mkstemp return 0; } -- cgit v1.2.3