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 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
--
-- tests/test_keywords.lua
-- Automated test suite for configuration block keyword filtering.
-- Copyright (c) 2008, 2009 Jason Perkins and the Premake project
--
T.keywords = { }
local suite = T.keywords
--
-- Keyword escaping tests
--
function suite.escapes_special_chars()
test.isequal("%.%-", path.wildcards(".-"))
end
function suite.escapes_star()
test.isequal("vs[^/]*", path.wildcards("vs*"))
end
function suite.escapes_star_star()
test.isequal("Images/.*%.bmp", path.wildcards("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
|