This repository has been archived on 2022-12-23. You can view files and clone it, but cannot push or open issues or pull requests.
fuck-premake-old2/tests/base/test_action.lua

74 lines
1.3 KiB
Lua
Raw Normal View History

2009-07-16 14:29:08 +00:00
--
-- tests/base/test_action.lua
-- Automated test suite for the action list.
-- Copyright (c) 2009 Jason Perkins and the Premake project
--
T.action = { }
--
-- Setup/teardown
--
local fake = {
trigger = "fake",
description = "Fake action used for testing",
}
function T.action.setup()
premake.action.list["fake"] = fake
solution "MySolution"
configurations "Debug"
project "MyProject"
premake.buildconfigs()
2009-07-16 14:29:08 +00:00
end
function T.action.teardown()
premake.action.list["fake"] = nil
2009-07-16 14:29:08 +00:00
end
--
-- Tests for call()
2009-07-16 14:29:08 +00:00
--
function T.action.CallCallsExecuteIfPresent()
2009-07-16 14:29:08 +00:00
local called = false
fake.execute = function () called = true end
premake.action.call("fake")
test.istrue(called)
end
function T.action.CallCallsOnSolutionIfPresent()
local called = false
fake.onsolution = function () called = true end
premake.action.call("fake")
test.istrue(called)
end
function T.action.CallCallsOnProjectIfPresent()
local called = false
fake.onproject = function () called = true end
premake.action.call("fake")
test.istrue(called)
end
2009-07-16 14:29:08 +00:00
function T.action.CallSkipsCallbacksIfNotPresent()
2009-07-16 14:29:08 +00:00
test.success(premake.action.call, "fake")
end
2009-09-29 18:32:34 +00:00
--
-- Tests for set()
--
function T.action.set_SetsActionOS()
local oldos = _OS
2009-09-29 18:32:34 +00:00
_OS = "linux"
premake.action.set("vs2008")
test.isequal(_OS, "windows")
_OS = oldos
2009-09-29 18:32:34 +00:00
end