diff options
author | Hisham <hisham@gobolinux.org> | 2016-10-19 01:36:11 -0400 |
---|---|---|
committer | Hisham <hisham@gobolinux.org> | 2016-10-19 01:36:11 -0400 |
commit | b1f0f80141fe4ddd622e7f525cd0da4d24ce72af (patch) | |
tree | 270c8eb43212f0acc97f3dac4568542abc9a1acd /tests | |
parent | aa18f3e127b3d11344d6472fe3647cdf0e8a8f08 (diff) | |
parent | 3c4e563d9c140319e28c419f2710b51a2f6d6d24 (diff) | |
download | luafilesystem-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.lua | 16 |
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" | |||
109 | result, mode = lfs.setmode(f, "text") | 111 | result, mode = lfs.setmode(f, "text") |
110 | assert(result and mode == "binary") | 112 | assert(result and mode == "binary") |
111 | f:close() | 113 | f:close() |
114 | local ok, err = pcall(lfs.setmode, f, "binary") | ||
115 | assert(not ok, "could setmode on closed file") | ||
116 | assert(err:find("closed file"), "bad error message for setmode on closed file") | ||
112 | 117 | ||
113 | io.write(".") | 118 | io.write(".") |
114 | io.flush() | 119 | io.flush() |
@@ -129,6 +134,17 @@ for key, value in pairs(attr) do | |||
129 | "lfs.attributes values not consistent") | 134 | "lfs.attributes values not consistent") |
130 | end | 135 | end |
131 | 136 | ||
137 | -- Check that lfs.attributes accepts a table as second argument | ||
138 | local attr2 = {} | ||
139 | lfs.attributes(tmpfile, attr2) | ||
140 | for key, value in pairs(attr2) do | ||
141 | assert (value == lfs.attributes (tmpfile, key), | ||
142 | "lfs.attributes values with table argument not consistent") | ||
143 | end | ||
144 | |||
145 | -- Check that extra arguments are ignored | ||
146 | lfs.attributes(tmpfile, attr2, nil) | ||
147 | |||
132 | -- Remove new file and directory | 148 | -- Remove new file and directory |
133 | assert (os.remove (tmpfile), "could not remove new file") | 149 | assert (os.remove (tmpfile), "could not remove new file") |
134 | assert (lfs.rmdir (tmpdir), "could not remove new directory") | 150 | assert (lfs.rmdir (tmpdir), "could not remove new directory") |