aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2016-10-19 01:36:11 -0400
committerHisham <hisham@gobolinux.org>2016-10-19 01:36:11 -0400
commitb1f0f80141fe4ddd622e7f525cd0da4d24ce72af (patch)
tree270c8eb43212f0acc97f3dac4568542abc9a1acd /tests
parentaa18f3e127b3d11344d6472fe3647cdf0e8a8f08 (diff)
parent3c4e563d9c140319e28c419f2710b51a2f6d6d24 (diff)
downloadluafilesystem-2.0.tar.gz
luafilesystem-2.0.tar.bz2
luafilesystem-2.0.zip
Merge branch 'master' into 2.02.0
Diffstat (limited to 'tests')
-rw-r--r--tests/test.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test.lua b/tests/test.lua
index 7876165..fd36ba7 100644
--- a/tests/test.lua
+++ b/tests/test.lua
@@ -93,6 +93,8 @@ if link_ok then
93 assert (link_ok == true, "successful lfs.link did not return true") 93 assert (link_ok == true, "successful lfs.link did not return true")
94 assert (lfs.attributes"_a_link_for_test_".mode == "file") 94 assert (lfs.attributes"_a_link_for_test_".mode == "file")
95 assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link") 95 assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link")
96 assert (lfs.symlinkattributes"_a_link_for_test_".target == tmpfile)
97 assert (lfs.symlinkattributes("_a_link_for_test_", "target") == tmpfile)
96 assert (lfs.link (tmpfile, "_a_hard_link_for_test_")) 98 assert (lfs.link (tmpfile, "_a_hard_link_for_test_"))
97 assert (lfs.attributes (tmpfile, "nlink") == 2) 99 assert (lfs.attributes (tmpfile, "nlink") == 2)
98 assert (os.remove"_a_link_for_test_") 100 assert (os.remove"_a_link_for_test_")
@@ -109,6 +111,9 @@ assert(result) -- on non-Windows platforms, mode is always returned as "binary"
109result, mode = lfs.setmode(f, "text") 111result, mode = lfs.setmode(f, "text")
110assert(result and mode == "binary") 112assert(result and mode == "binary")
111f:close() 113f:close()
114local ok, err = pcall(lfs.setmode, f, "binary")
115assert(not ok, "could setmode on closed file")
116assert(err:find("closed file"), "bad error message for setmode on closed file")
112 117
113io.write(".") 118io.write(".")
114io.flush() 119io.flush()
@@ -129,6 +134,17 @@ for key, value in pairs(attr) do
129 "lfs.attributes values not consistent") 134 "lfs.attributes values not consistent")
130end 135end
131 136
137-- Check that lfs.attributes accepts a table as second argument
138local attr2 = {}
139lfs.attributes(tmpfile, attr2)
140for key, value in pairs(attr2) do
141 assert (value == lfs.attributes (tmpfile, key),
142 "lfs.attributes values with table argument not consistent")
143end
144
145-- Check that extra arguments are ignored
146lfs.attributes(tmpfile, attr2, nil)
147
132-- Remove new file and directory 148-- Remove new file and directory
133assert (os.remove (tmpfile), "could not remove new file") 149assert (os.remove (tmpfile), "could not remove new file")
134assert (lfs.rmdir (tmpdir), "could not remove new directory") 150assert (lfs.rmdir (tmpdir), "could not remove new directory")