Removed override of Lua type(); no longer required by Premake APIs

This commit is contained in:
Jason Perkins 2013-11-20 13:26:52 -05:00
parent 06aa897261
commit 1ee62b13bc
5 changed files with 12 additions and 25 deletions

View File

@ -152,21 +152,3 @@
function printf(msg, ...) function printf(msg, ...)
print(string.format(msg, unpack(arg))) print(string.format(msg, unpack(arg)))
end end
--
-- An extension to type() to identify project object types by reading the
-- "__type" field from the metatable.
--
local builtin_type = type
function type(t)
local mt = getmetatable(t)
if (mt) then
if (mt.__type) then
return mt.__type
end
end
return builtin_type(t)
end

View File

@ -37,7 +37,6 @@
-- attach a type descriptor -- attach a type descriptor
setmetatable(prj, { setmetatable(prj, {
__type = "project",
__index = function(prj, key) __index = function(prj, key)
return prj.configset[key] return prj.configset[key]
end, end,

View File

@ -43,7 +43,6 @@
-- attach a type descriptor -- attach a type descriptor
setmetatable(sln, { setmetatable(sln, {
__type = "solution",
__index = function(sln, key) __index = function(sln, key)
return sln.configset[key] return sln.configset[key]
end, end,

View File

@ -38,12 +38,12 @@
-- --
function suite.solution_setsActiveScope() function suite.solution_setsActiveScope()
test.isequal(api.scope.solution, sln) test.issame(api.scope.solution, sln)
end end
function suite.project_setsActiveScope() function suite.project_setsActiveScope()
local prj = project("MyProject") local prj = project("MyProject")
test.isequal(api.scope.project, prj) test.issame(api.scope.project, prj)
end end
@ -56,7 +56,7 @@
project("MyProject") project("MyProject")
group("MyGroup") group("MyGroup")
solution() solution()
test.isequal(sln, api.scope.solution) test.issame(sln, api.scope.solution)
test.isnil(api.scope.project) test.isnil(api.scope.project)
test.isnil(api.scope.group) test.isnil(api.scope.group)
end end
@ -65,7 +65,7 @@
local prj = project("MyProject") local prj = project("MyProject")
group("MyGroup") group("MyGroup")
project() project()
test.isequal(prj, api.scope.project) test.issame(prj, api.scope.project)
end end
@ -88,6 +88,6 @@
group("MyGroup") group("MyGroup")
configuration("Debug") configuration("Debug")
project "*" project "*"
test.isequal(sln, api.scope.solution) test.issame(sln, api.scope.solution)
test.isnil(api.scope.project) test.isnil(api.scope.project)
end end

View File

@ -156,6 +156,13 @@
end end
function test.issame(expected, action)
if expected ~= action then
test.fail("expected same value")
end
end
function test.istrue(value) function test.istrue(value)
if (not value) then if (not value) then
test.fail("expected true but was false") test.fail("expected true but was false")