summaryrefslogtreecommitdiff
path: root/tests/modules/os/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-17 00:47:53 +0800
committerruki <[email protected]>2022-09-17 00:47:53 +0800
commitc051f1df4c095d45f0310d6027711b15fc340b1a (patch)
tree45fe0c0d1fc90173239427810dd29efa345aab6b /tests/modules/os/test.lua
parentb5c41835eeac49722a90906a039908a04e3e3836 (diff)
improve tests for os
Diffstat (limited to 'tests/modules/os/test.lua')
-rw-r--r--tests/modules/os/test.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/modules/os/test.lua b/tests/modules/os/test.lua
index 2b26cd939..03d948dfe 100644
--- a/tests/modules/os/test.lua
+++ b/tests/modules/os/test.lua
@@ -49,6 +49,23 @@ function test_cp_mvdir_into_another_dir(t)
t:require(os.mclock() >= tm)
end
+function test_cp_symlink(t)
+ if is_subhost("windows") then
+ return
+ end
+ os.touch("test1")
+ os.ln("test1", "test2")
+ t:require(os.isfile("test1"))
+ t:require(os.isfile("test2"))
+ t:require(os.islink("test2"))
+ os.cp("test2", "test3")
+ t:require(os.isfile("test3"))
+ t:require(not os.islink("test3"))
+ os.cp("test2", "test4", {symlink = true})
+ t:require(os.isfile("test4"))
+ t:require(os.islink("test4"))
+end
+
function test_setenv(t)
-- get mclock
local tm = os.mclock()
@@ -111,3 +128,4 @@ function test_args(t)
t:are_equal(os.args('-DTEST=hello'), '-DTEST=hello') -- irreversible
t:are_equal(os.args({'-DTEST="hello world"', '-DTEST2="hello world2"'}), '"-DTEST=\\\"hello world\\\"" "-DTEST2=\\\"hello world2\\\""')
end
+