1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
--
-- 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()
end
function T.action.teardown()
premake.action.list["fake"] = nil
end
--
-- Tests for call()
--
function T.action.CallCallsExecuteIfPresent()
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
function T.action.CallSkipsCallbacksIfNotPresent()
test.success(premake.action.call, "fake")
end
--
-- Tests for set()
--
function T.action.set_SetsActionOS()
local oldos = _OS
_OS = "linux"
premake.action.set("vs2008")
test.isequal(_OS, "windows")
_OS = oldos
end
|