summaryrefslogtreecommitdiff
path: root/tests/modules/path/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-09 22:35:44 +0800
committerruki <[email protected]>2022-05-09 22:35:44 +0800
commite78095da9381e3b45922086e9b292b3b7ab49009 (patch)
treeecdea517e84a2be3f19053669c81700e0d00b7f4 /tests/modules/path/test.lua
parentd0f3fac5cb37cc08a5039745ef546889561751e0 (diff)
improve path test
Diffstat (limited to 'tests/modules/path/test.lua')
-rw-r--r--tests/modules/path/test.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/modules/path/test.lua b/tests/modules/path/test.lua
index 2d4b09238..f68a57e5f 100644
--- a/tests/modules/path/test.lua
+++ b/tests/modules/path/test.lua
@@ -127,3 +127,10 @@ function test_normalize(t)
end
end
+function test_instance(t)
+ t:are_equal(path("/tmp/a"):str(), "/tmp/a")
+ t:are_equal(path("/tmp/a"):directory():str(), "/tmp")
+ t:are_equal(path("/tmp/a", function (p) return "--key=" .. p end):str(), "--key=/tmp/a")
+ t:are_equal(path("/tmp/a", function (p) return "--key=" .. p end):rawstr(), "/tmp/a")
+ t:are_equal(path("/tmp/a", function (p) return "--key=" .. p end):clone():set("/tmp/b"):str(), "--key=/tmp/b")
+end