aboutsummaryrefslogtreecommitdiff
path: root/tests/test.lua
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2011-06-09 14:23:44 +0100
committerReuben Thomas <rrt@sc3d.org>2011-06-09 19:53:41 +0100
commit361cede4d08073183d3546a78763e7b62d6be9ef (patch)
treef86f63145c8dbd3a5cf99c785bfde60740d0a132 /tests/test.lua
parent3140ca4db8fbc35efaf44a4dd5176bfd0d99c713 (diff)
downloadluafilesystem-361cede4d08073183d3546a78763e7b62d6be9ef.tar.gz
luafilesystem-361cede4d08073183d3546a78763e7b62d6be9ef.tar.bz2
luafilesystem-361cede4d08073183d3546a78763e7b62d6be9ef.zip
Add trivial implementation of setmode on non-Windows platforms.
Diffstat (limited to 'tests/test.lua')
-rw-r--r--tests/test.lua16
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/test.lua b/tests/test.lua
index 133bac2..6eb9f70 100644
--- a/tests/test.lua
+++ b/tests/test.lua
@@ -76,15 +76,13 @@ if (os.execute ("ln -s "..tmpfile.." _a_link_for_test_")) then
76 assert (os.remove"_a_link_for_test_") 76 assert (os.remove"_a_link_for_test_")
77end 77end
78 78
79if lfs.setmode then 79-- Checking text/binary modes (only has an effect in Windows)
80 -- Checking text/binary modes (works only in Windows) 80local f = io.open(tmpfile, "w")
81 local f = io.open(tmpfile, "w") 81local result, mode = lfs.setmode(f, "binary")
82 local result, mode = lfs.setmode(f, "binary") 82assert(result) -- on non-Windows platforms, mode is always returned as "binary"
83 assert((result and mode == "text") or (not result and mode == "setmode not supported on this platform")) 83result, mode = lfs.setmode(f, "text")
84 result, mode = lfs.setmode(f, "text") 84assert(result and mode == "binary")
85 assert((result and mode == "binary") or (not result and mode == "setmode not supported on this platform")) 85f:close()
86 f:close()
87end
88 86
89-- Restore access time to current value 87-- Restore access time to current value
90assert (lfs.touch (tmpfile, attrib.access, attrib.modification)) 88assert (lfs.touch (tmpfile, attrib.access, attrib.modification))