diff options
author | Reuben Thomas <rrt@sc3d.org> | 2011-06-09 14:23:44 +0100 |
---|---|---|
committer | Reuben Thomas <rrt@sc3d.org> | 2011-06-09 19:53:41 +0100 |
commit | 361cede4d08073183d3546a78763e7b62d6be9ef (patch) | |
tree | f86f63145c8dbd3a5cf99c785bfde60740d0a132 /tests/test.lua | |
parent | 3140ca4db8fbc35efaf44a4dd5176bfd0d99c713 (diff) | |
download | luafilesystem-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.lua | 16 |
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_") |
77 | end | 77 | end |
78 | 78 | ||
79 | if lfs.setmode then | 79 | -- Checking text/binary modes (only has an effect in Windows) |
80 | -- Checking text/binary modes (works only in Windows) | 80 | local f = io.open(tmpfile, "w") |
81 | local f = io.open(tmpfile, "w") | 81 | local result, mode = lfs.setmode(f, "binary") |
82 | local result, mode = lfs.setmode(f, "binary") | 82 | assert(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")) | 83 | result, mode = lfs.setmode(f, "text") |
84 | result, mode = lfs.setmode(f, "text") | 84 | assert(result and mode == "binary") |
85 | assert((result and mode == "binary") or (not result and mode == "setmode not supported on this platform")) | 85 | f:close() |
86 | f:close() | ||
87 | end | ||
88 | 86 | ||
89 | -- Restore access time to current value | 87 | -- Restore access time to current value |
90 | assert (lfs.touch (tmpfile, attrib.access, attrib.modification)) | 88 | assert (lfs.touch (tmpfile, attrib.access, attrib.modification)) |