Make improvements
This commit is contained in:
@@ -19,10 +19,12 @@
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/conv/conv.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
TEST(basename, test) {
|
||||
EXPECT_STREQ("", basename(""));
|
||||
EXPECT_STREQ("/", basename("/"));
|
||||
EXPECT_STREQ("hello", basename("hello"));
|
||||
EXPECT_STREQ("there", basename("hello/there"));
|
||||
EXPECT_STREQ("yo", basename("hello/there/yo"));
|
||||
@@ -42,3 +44,13 @@ TEST(basename, testWindows_isGrantedRespect) {
|
||||
EXPECT_STREQ("there", basename("hello\\there"));
|
||||
EXPECT_STREQ("yo", basename("hello\\there\\yo"));
|
||||
}
|
||||
|
||||
TEST(dirname, test) {
|
||||
EXPECT_STREQ("/usr", dirname(strdup("/usr/lib")));
|
||||
EXPECT_STREQ("usr", dirname(strdup("usr/lib")));
|
||||
EXPECT_STREQ("/", dirname(strdup("/usr/")));
|
||||
EXPECT_STREQ("/", dirname(strdup("/")));
|
||||
EXPECT_STREQ(".", dirname(strdup("hello")));
|
||||
EXPECT_STREQ(".", dirname(strdup(".")));
|
||||
EXPECT_STREQ(".", dirname(strdup("..")));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ TEST_LIBC_CONV_DIRECTDEPS = \
|
||||
LIBC_CONV \
|
||||
LIBC_FMT \
|
||||
LIBC_LOG \
|
||||
LIBC_MEM \
|
||||
LIBC_STDIO \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_STUBS \
|
||||
|
||||
Reference in New Issue
Block a user