summaryrefslogtreecommitdiff
path: root/userland
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-11-22 21:08:08 +0100
committerAnton Kling <anton@kling.gg>2023-11-22 21:08:08 +0100
commit90e4da9473ee2fc6419b7821274ec102219551f9 (patch)
tree750209b692e99ce00c72c016bfa5c50b949cb98d /userland
parentbf2d121899c028eed140b679b4e059db8af91fe8 (diff)
Test: Add test case for realpath()
Diffstat (limited to 'userland')
-rw-r--r--userland/test/test.c18
1 files changed, 18 insertions, 0 deletions
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;
}