Make table.isempty work with table which has a key as false (Baiyan Huang)
This commit is contained in:
parent
b3fdb1457d
commit
347f10a379
@ -224,7 +224,7 @@
|
||||
--
|
||||
|
||||
function table.isempty(t)
|
||||
return not next(t)
|
||||
return next(t) == nil
|
||||
end
|
||||
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
--
|
||||
-- tests/base/test_table.lua
|
||||
-- Automated test suite for the new table functions.
|
||||
-- Copyright (c) 2008-2010 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2008-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
|
||||
T.table = { }
|
||||
local suite = T.table
|
||||
local suite = test.declare("table")
|
||||
|
||||
local t
|
||||
|
||||
@ -67,3 +66,11 @@
|
||||
function suite.isempty_ReturnsFalseOnNotEmpty()
|
||||
test.isfalse(table.isempty({ 1 }))
|
||||
end
|
||||
|
||||
function suite.isempty_ReturnsFalseOnNotEmptyMap()
|
||||
test.isfalse(table.isempty({ name = 'premake' }))
|
||||
end
|
||||
|
||||
function suite.isempty_ReturnsFalseOnNotEmptyMapWithFalseKey()
|
||||
test.isfalse(table.isempty({ [false] = 0 }))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user