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