premake/tests/workspace/test_location.lua

45 lines
831 B
Lua
Raw Normal View History

--
-- tests/workspace/test_location.lua
-- Test handling of the workspace's location field.
-- Copyright (c) 2013-2015 Jason Perkins and the Premake project
--
local suite = test.declare("workspace_location")
--
-- Setup and teardown
--
2015-08-28 20:16:14 +00:00
local wks
function suite.setup()
wks = workspace("MyWorkspace")
end
local function prepare()
wks = test.getWorkspace(wks)
end
--
-- If no explicit location is set, the location should be set to the
-- directory containing the script which defined the workspace.
--
function suite.usesScriptLocation_onNoLocation()
prepare()
2015-08-28 20:16:14 +00:00
test.isequal(os.getcwd(), wks.location)
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)
end