summaryrefslogtreecommitdiff
path: root/tests/modules/os/test.lua
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-21 09:26:31 +0800
committerTitanSnow <[email protected]>2017-05-21 09:50:52 +0800
commit4f67991edadbedab69f36a7a3c73b44ff3f65ba6 (patch)
tree274a663906c13fc9d8cf4a10c507a505f0f7bc4e /tests/modules/os/test.lua
parent9aeced3ae3e4fc43631208ed6e54ce256ce184aa (diff)
add more test on cp/mv
Diffstat (limited to 'tests/modules/os/test.lua')
-rw-r--r--tests/modules/os/test.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/modules/os/test.lua b/tests/modules/os/test.lua
index 29dbbcc39..ffb81d3cc 100644
--- a/tests/modules/os/test.lua
+++ b/tests/modules/os/test.lua
@@ -1,4 +1,5 @@
function main()
+ -- test cpdir
os.mkdir("test1")
assert(os.exists("test1"))
os.cp("test1","test2")
@@ -8,4 +9,23 @@ function main()
io.writefile("test2/awd","awd")
os.rmdir("test2")
assert(not os.exists("test2"))
+ -- test rename
+ os.mkdir("test1")
+ assert(os.exists("test1"))
+ os.mv("test1","test2")
+ assert(not os.exists("test1"))
+ assert(os.exists("test2"))
+ os.rmdir("test2")
+ assert(not os.exists("test2"))
+ -- test cp/mvdir into another dir
+ os.mkdir("test1")
+ os.mkdir("test2")
+ assert(os.exists("test1") and os.exists("test2"))
+ os.cp("test1","test2")
+ assert(os.exists("test2/test1"))
+ os.mv("test1","test2/test1")
+ assert(not os.exists("test1"))
+ assert(os.exists("test2/test1/test1"))
+ os.rmdir("test2")
+ assert(not os.exists("test2"))
end