From 361cede4d08073183d3546a78763e7b62d6be9ef Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Thu, 9 Jun 2011 14:23:44 +0100 Subject: Add trivial implementation of setmode on non-Windows platforms. --- tests/test.lua | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tests') 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 assert (os.remove"_a_link_for_test_") end -if lfs.setmode then - -- Checking text/binary modes (works only in Windows) - local f = io.open(tmpfile, "w") - local result, mode = lfs.setmode(f, "binary") - assert((result and mode == "text") or (not result and mode == "setmode not supported on this platform")) - result, mode = lfs.setmode(f, "text") - assert((result and mode == "binary") or (not result and mode == "setmode not supported on this platform")) - f:close() -end +-- Checking text/binary modes (only has an effect in Windows) +local f = io.open(tmpfile, "w") +local result, mode = lfs.setmode(f, "binary") +assert(result) -- on non-Windows platforms, mode is always returned as "binary" +result, mode = lfs.setmode(f, "text") +assert(result and mode == "binary") +f:close() -- Restore access time to current value assert (lfs.touch (tmpfile, attrib.access, attrib.modification)) -- cgit v1.2.3-55-g6feb