Merge pull request #1075 from LORgames/ssurtees/aliasTests
Fixed bug with alias tests that caused one to three extra tests to be run
This commit is contained in:
commit
a2cd65bb50
@ -5,60 +5,61 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
local suite = test.declare("premake_alias")
|
local suite = test.declare("premake_alias")
|
||||||
|
local m = {}
|
||||||
|
|
||||||
local p = premake
|
local p = premake
|
||||||
|
|
||||||
|
|
||||||
function suite.setup()
|
function suite.setup()
|
||||||
suite.testfunc = function()
|
m.testfunc = function()
|
||||||
return 48
|
return 48
|
||||||
end
|
end
|
||||||
suite.aliased = nil
|
m.aliased = nil
|
||||||
suite.aliased2 = nil
|
m.aliased2 = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.returnsOriginalFunction_onNoAlias()
|
function suite.returnsOriginalFunction_onNoAlias()
|
||||||
local scope, f = p.resolveAlias(suite, "testfunc")
|
local scope, f = p.resolveAlias(m, "testfunc")
|
||||||
test.isequal("testfunc", f)
|
test.isequal("testfunc", f)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.pointsAliasToOriginalFunction()
|
function suite.pointsAliasToOriginalFunction()
|
||||||
p.alias(suite, "testfunc", "aliased")
|
p.alias(m, "testfunc", "aliased")
|
||||||
test.isequal(48, suite.aliased())
|
test.isequal(48, m.aliased())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.returnsOriginalFunction_onAlias()
|
function suite.returnsOriginalFunction_onAlias()
|
||||||
p.alias(suite, "testfunc", "aliased")
|
p.alias(m, "testfunc", "aliased")
|
||||||
local scope, f = p.resolveAlias(suite, "aliased")
|
local scope, f = p.resolveAlias(m, "aliased")
|
||||||
test.isequal("testfunc", f)
|
test.isequal("testfunc", f)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.returnsOriginalFunction_onChainedAliases()
|
function suite.returnsOriginalFunction_onChainedAliases()
|
||||||
p.alias(suite, "testfunc", "aliased")
|
p.alias(m, "testfunc", "aliased")
|
||||||
p.alias(suite, "aliased", "aliased2")
|
p.alias(m, "aliased", "aliased2")
|
||||||
local scope, f = p.resolveAlias(suite, "aliased2")
|
local scope, f = p.resolveAlias(m, "aliased2")
|
||||||
test.isequal("testfunc", f)
|
test.isequal("testfunc", f)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.overrideResolvesAliases()
|
function suite.overrideResolvesAliases()
|
||||||
p.alias(suite, "testfunc", "aliased")
|
p.alias(m, "testfunc", "aliased")
|
||||||
p.override(suite, "aliased", function(base)
|
p.override(m, "aliased", function(base)
|
||||||
return base() + 1
|
return base() + 1
|
||||||
end)
|
end)
|
||||||
test.isequal(49, suite.testfunc())
|
test.isequal(49, m.testfunc())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.aliasTracksOverrides()
|
function suite.aliasTracksOverrides()
|
||||||
p.alias(suite, "testfunc", "aliased")
|
p.alias(m, "testfunc", "aliased")
|
||||||
p.override(suite, "testfunc", function(base)
|
p.override(m, "testfunc", function(base)
|
||||||
return base() + 1
|
return base() + 1
|
||||||
end)
|
end)
|
||||||
test.isequal(49, suite.aliased())
|
test.isequal(49, m.aliased())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user