2014-02-25 18:17:04 +00:00
|
|
|
--
|
|
|
|
-- tests/base/test_option.lua
|
|
|
|
-- Verify the handling of command line options and the _OPTIONS table.
|
|
|
|
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
|
|
|
--
|
|
|
|
|
2017-04-25 05:44:13 +00:00
|
|
|
local p = premake
|
2014-02-25 18:17:04 +00:00
|
|
|
local suite = test.declare("base_option")
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup and teardown.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.setup()
|
|
|
|
_OPTIONS["testopt"] = "testopt"
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.teardown()
|
|
|
|
_OPTIONS["testopt"] = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Because we can't control how the user will type in options on the
|
|
|
|
-- command line, all key lookups should be case insensitive.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.returnsCorrectOption_onMixedCase()
|
|
|
|
test.isnotnil(_OPTIONS["TestOpt"])
|
|
|
|
end
|
2015-08-27 12:34:42 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Because we can't control how the user will type in options in the
|
|
|
|
-- premake script, keys should be stored in lowercase.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.storesOptionCorrectly_onMixedCase()
|
|
|
|
newoption {
|
|
|
|
trigger = "TestOpt2",
|
|
|
|
description = "Testing",
|
|
|
|
}
|
|
|
|
|
2017-04-25 05:44:13 +00:00
|
|
|
test.isnotnil(p.option.get("testopt2"))
|
2015-08-27 12:34:42 +00:00
|
|
|
end
|