summaryrefslogtreecommitdiff
path: root/tests/modules/path/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-01-21 11:59:57 +0800
committerGitHub <[email protected]>2026-01-21 11:59:57 +0800
commitf8d44002372ca91bbb29cf3548c306f226e6ef4e (patch)
treebdc4a15863537a347084a5e85bf75beb75056c00 /tests/modules/path/test.lua
parent9e58120568d395b5a636daa7d0f23150fe87bb95 (diff)
parent6ff8486cd3297ca0e93518c33e32678c97128a3f (diff)
Merge pull request #7246 from xmake-io/utf8
Add utf8 module
Diffstat (limited to 'tests/modules/path/test.lua')
-rw-r--r--tests/modules/path/test.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/modules/path/test.lua b/tests/modules/path/test.lua
index f68a57e5f..57f7d06bc 100644
--- a/tests/modules/path/test.lua
+++ b/tests/modules/path/test.lua
@@ -34,6 +34,23 @@ function test_extension(t)
t:are_equal(path.extension("\\home\\foo.so"), ".so")
end
+function test_filename(t)
+ t:are_equal(path.filename("foo"), "foo")
+ t:are_equal(path.filename("foo.so"), "foo.so")
+ t:are_equal(path.filename("/tmp/foo.so"), "foo.so")
+ t:are_equal(path.filename("c:\\tmp\\foo.so"), "foo.so")
+ t:are_equal(path.filename("/tmp/.."), "..")
+ t:are_equal(path.filename("/tmp/."), ".")
+ t:are_equal(path.filename("/"), "")
+ t:are_equal(path.filename(""), "")
+
+ -- unicode
+ t:are_equal(path.filename("Unicode 测试/test.lua"), "test.lua")
+ t:are_equal(path.filename("Unicode 测试/foo/test.lua"), "test.lua")
+ t:are_equal(path.filename("测试/test.lua"), "test.lua")
+ t:are_equal(path.filename("测试\\test.lua"), "test.lua")
+end
+
function test_directory(t)
t:are_equal(path.directory(""), nil)
t:are_equal(path.directory("."), nil)