Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug with alias tests that caused one to three extra tests to be run #1075

Merged
merged 1 commit into from
Apr 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions tests/base/test_aliasing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,61 @@
--

local suite = test.declare("premake_alias")
local m = {}

local p = premake


function suite.setup()
suite.testfunc = function()
m.testfunc = function()
return 48
end
suite.aliased = nil
suite.aliased2 = nil
m.aliased = nil
m.aliased2 = nil
end


function suite.returnsOriginalFunction_onNoAlias()
local scope, f = p.resolveAlias(suite, "testfunc")
local scope, f = p.resolveAlias(m, "testfunc")
test.isequal("testfunc", f)
end


function suite.pointsAliasToOriginalFunction()
p.alias(suite, "testfunc", "aliased")
test.isequal(48, suite.aliased())
p.alias(m, "testfunc", "aliased")
test.isequal(48, m.aliased())
end


function suite.returnsOriginalFunction_onAlias()
p.alias(suite, "testfunc", "aliased")
local scope, f = p.resolveAlias(suite, "aliased")
p.alias(m, "testfunc", "aliased")
local scope, f = p.resolveAlias(m, "aliased")
test.isequal("testfunc", f)
end


function suite.returnsOriginalFunction_onChainedAliases()
p.alias(suite, "testfunc", "aliased")
p.alias(suite, "aliased", "aliased2")
local scope, f = p.resolveAlias(suite, "aliased2")
p.alias(m, "testfunc", "aliased")
p.alias(m, "aliased", "aliased2")
local scope, f = p.resolveAlias(m, "aliased2")
test.isequal("testfunc", f)
end


function suite.overrideResolvesAliases()
p.alias(suite, "testfunc", "aliased")
p.override(suite, "aliased", function(base)
p.alias(m, "testfunc", "aliased")
p.override(m, "aliased", function(base)
return base() + 1
end)
test.isequal(49, suite.testfunc())
test.isequal(49, m.testfunc())
end


function suite.aliasTracksOverrides()
p.alias(suite, "testfunc", "aliased")
p.override(suite, "testfunc", function(base)
p.alias(m, "testfunc", "aliased")
p.override(m, "testfunc", function(base)
return base() + 1
end)
test.isequal(49, suite.aliased())
test.isequal(49, m.aliased())
end