92 lines
2.3 KiB
Lua
92 lines
2.3 KiB
Lua
|
--
|
||
|
-- tests/test_keywords.lua
|
||
|
-- Automated test suite for configuration block keyword filtering.
|
||
|
-- Copyright (c) 2008 Jason Perkins and the Premake project
|
||
|
--
|
||
|
|
||
|
T.keywords = { }
|
||
|
|
||
|
--
|
||
|
-- Keyword escaping tests
|
||
|
--
|
||
|
|
||
|
function T.keywords.escapes_lowercase()
|
||
|
test.isequal("windows", premake.escapekeyword("Windows"))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.escapes_special_chars()
|
||
|
test.isequal("%.%-", premake.escapekeyword(".-"))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.escapes_star()
|
||
|
test.isequal("vs[^/]*", premake.escapekeyword("vs*"))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.escapes_star_star()
|
||
|
test.isequal("images/.*%.bmp", premake.escapekeyword("Images/**.bmp"))
|
||
|
end
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Keyword matching tests
|
||
|
--
|
||
|
|
||
|
function T.keywords.matches_simple_strings()
|
||
|
test.istrue(premake.iskeywordmatch("debug", { "debug", "windows", "vs2005" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.match_files_with_simple_strings()
|
||
|
test.isfalse(premake.iskeywordmatch("release", { "debug", "windows", "vs2005" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.matches_with_patterns()
|
||
|
test.istrue(premake.iskeywordmatch("vs20.*", { "debug", "windows", "vs2005" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.match_fails_with_not_term()
|
||
|
test.isfalse(premake.iskeywordmatch("not windows", { "debug", "windows", "vs2005" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.match_ok_with_not_term()
|
||
|
test.istrue(premake.iskeywordmatch("not linux", { "debug", "windows", "vs2005" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.match_ok_with_first_or()
|
||
|
test.istrue(premake.iskeywordmatch("windows or linux", { "debug", "windows", "vs2005" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.match_ok_with_first_or()
|
||
|
test.istrue(premake.iskeywordmatch("windows or linux", { "debug", "linux", "vs2005" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.match_ok_with_not_and_or()
|
||
|
test.istrue(premake.iskeywordmatch("not macosx or linux", { "debug", "windows", "vs2005" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.match_fail_with_not_and_or()
|
||
|
test.isfalse(premake.iskeywordmatch("not macosx or windows", { "debug", "windows", "vs2005" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.match_ok_required_term()
|
||
|
test.istrue(premake.iskeywordsmatch({ "debug", "hello.c" }, { "debug", "windows", "vs2005", required="hello.c" }))
|
||
|
end
|
||
|
|
||
|
|
||
|
function T.keywords.match_fail_required_term()
|
||
|
test.isfalse(premake.iskeywordsmatch({ "debug" }, { "debug", "windows", "vs2005", required="hello.c" }))
|
||
|
end
|