2013-09-30 14:16:56 +00:00
|
|
|
--
|
|
|
|
-- tests/project/test_location.lua
|
|
|
|
-- Test handling of the projects's location field.
|
|
|
|
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
|
|
|
--
|
|
|
|
|
|
|
|
local suite = test.declare("project_location")
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup and teardown
|
|
|
|
--
|
|
|
|
|
2015-08-28 20:16:14 +00:00
|
|
|
local wks, prj
|
2013-09-30 14:16:56 +00:00
|
|
|
|
|
|
|
function suite.setup()
|
2015-08-28 20:16:14 +00:00
|
|
|
wks = test.createWorkspace()
|
2013-09-30 14:16:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local function prepare()
|
2015-08-30 15:38:35 +00:00
|
|
|
prj = test.getproject(wks, 1)
|
2013-09-30 14:16:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If no explicit location is set, the location should be set to the
|
|
|
|
-- directory containing the script which defined the project.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.usesScriptLocation_onNoLocation()
|
|
|
|
prepare()
|
|
|
|
test.isequal(os.getcwd(), prj.location)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If an explicit location has been set, use it.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.usesLocation_onLocationSet()
|
|
|
|
location "build"
|
|
|
|
prepare()
|
|
|
|
test.isequal(path.join(os.getcwd(), "build"), prj.location)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2015-08-30 15:38:35 +00:00
|
|
|
-- If the workspace sets a location, and the project does not, it should
|
|
|
|
-- inherit the value from the workspace.
|
2013-09-30 14:16:56 +00:00
|
|
|
--
|
|
|
|
|
2015-08-30 15:38:35 +00:00
|
|
|
function suite.inheritsWorkspaceLocation_onNoProjectLocation()
|
|
|
|
workspace ()
|
2013-09-30 14:16:56 +00:00
|
|
|
location "build"
|
|
|
|
prepare()
|
|
|
|
test.isequal(path.join(os.getcwd(), "build"), prj.location)
|
|
|
|
end
|