This repository has been archived on 2022-12-23. You can view files and clone it, but cannot push or open issues or pull requests.
fuck-premake-old2/tests/base/test_table.lua

58 lines
1.0 KiB
Lua
Raw Normal View History

--
-- tests/base/test_table.lua
-- Automated test suite for the new table functions.
-- Copyright (c) 2008-2010 Jason Perkins and the Premake project
--
T.table = { }
local suite = T.table
--
-- table.contains() tests
--
function suite.contains_OnContained()
t = { "one", "two", "three" }
test.istrue( table.contains(t, "two") )
end
function suite.contains_OnNotContained()
t = { "one", "two", "three" }
test.isfalse( table.contains(t, "four") )
end
--
-- table.flatten() tests
--
function suite.flatten_OnMixedValues()
t = { "a", { "b", "c" }, "d" }
test.isequal({ "a", "b", "c", "d" }, table.flatten(t))
end
--
-- table.implode() tests
--
function suite.implode()
t = { "one", "two", "three", "four" }
test.isequal("[one], [two], [three], [four]", table.implode(t, "[", "]", ", "))
end
2009-08-27 13:27:47 +00:00
--
-- table.isempty() tests
--
function suite.isempty_ReturnsTrueOnEmpty()
2009-08-27 13:27:47 +00:00
test.istrue(table.isempty({}))
end
function suite.isempty_ReturnsFalseOnNotEmpty()
2009-08-27 13:27:47 +00:00
test.isfalse(table.isempty({ 1 }))
end