Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keplerproject/luafilesystem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormascarenhas <mascarenhas>2009-06-04 00:49:18 +0400
committermascarenhas <mascarenhas>2009-06-04 00:49:18 +0400
commit375d009d89eae607b2b95615f42134e4cdd8a2f6 (patch)
tree62d0257d079549c4a8cdfe1b794872951770a95b /tests
parentc1eff3de6befe526c17da32210887ce38c0cb78f (diff)
added explicit next and close methods to second return value of lfs.dir (the directory object), for explicit iteration or explicit closing
Diffstat (limited to 'tests')
-rw-r--r--tests/test.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test.lua b/tests/test.lua
index 1fd6157..7111074 100644
--- a/tests/test.lua
+++ b/tests/test.lua
@@ -110,4 +110,21 @@ for i = 1, 4000 do
count = count + 1
end
end
+
+-- Stressing directory iterator, explicit version
+count = 0
+for i = 1, 4000 do
+ local iter, dir = lfs.dir(tmp)
+ local file = dir:next()
+ while file do
+ count = count + 1
+ file = dir:next()
+ end
+ assert(not pcall(dir.next, dir))
+end
+
+-- directory explicit close
+local iter, dir = lfs.dir(tmp)
+dir:close()
+assert(not pcall(dir.next, dir))
print"Ok!"