This commit is contained in:
Grump
2020-06-18 13:01:39 +02:00
parent 30d36b97e1
commit 3d4a838105
2 changed files with 52 additions and 36 deletions

View File

@@ -137,14 +137,24 @@ function test_fs_getDirectoryItems()
for i = 1, #items2 do
equals(map[items2[i]], map2[items2[i]])
equals(fs.getInfo('data/' .. items2[i]), love.filesystem.getInfo('data/' .. items2[i]))
end
equals(#fs.getDirectoryItems('does_not_exist'), 0)
end
function test_fs_getDirectoryItemsInfo()
local items, map = fs.getDirectoryItems('data'), {}
for i = 1, #items do map[items[i]] = true end
local files = fs.getDirectoryItems('data')
local items, map = {}, {}
for i = 1, #files do
local info = fs.getInfo('data/' .. files[i])
if info then
info.name = files[i]
table.insert(items, info)
end
end
for i = 1, #items do map[items[i].name] = true end
local itemsEx, mapEx = fs.getDirectoryItemsInfo('data'), {}
for i = 1, #itemsEx do mapEx[itemsEx[i].name] = itemsEx[i] end
@@ -203,6 +213,12 @@ function test_fs_getInfo()
equals(info.type, 'file')
equals(info.size, testSize1)
notEquals(info.modtime, nil)
local info = fs.getInfo(testFile2)
notEquals(info, nil)
equals(info.type, 'file')
equals(info.size, testSize2)
notEquals(info.modtime, nil)
end
function test_fs_createDirectory()