diff options
| author | ruki <[email protected]> | 2024-04-17 22:50:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-04-17 22:50:06 +0800 |
| commit | 2190b08db954738da36feeb820e8771383caa5e0 (patch) | |
| tree | d0a1fd3d98c6c21dfbe2acdf0c5be1f46788d54f /tests/modules/private/select_script | |
| parent | e39ff9d876e33cc36e4eb9e196ca665ecefc9f96 (diff) | |
support logical expr for selecting script
Diffstat (limited to 'tests/modules/private/select_script')
| -rw-r--r-- | tests/modules/private/select_script/test.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/modules/private/select_script/test.lua b/tests/modules/private/select_script/test.lua index 90258c232..50ff3acee 100644 --- a/tests/modules/private/select_script/test.lua +++ b/tests/modules/private/select_script/test.lua @@ -3,7 +3,7 @@ import("private.core.base.select_script") function _match_patterns(patterns, opt) local scripts = {} for _, pattern in ipairs(patterns) do - pattern = pattern:gsub("([%+%.%-%^%$%(%)%%])", "%%%1") + pattern = pattern:gsub("([%+%.%-%^%$%%])", "%%%1") pattern = pattern:gsub("%*", "\001") pattern = pattern:gsub("\001", ".*") scripts[pattern] = true @@ -28,6 +28,8 @@ function test_plat_only(t) end function test_plat_arch(t) + t:require(_match_patterns("!wasm|!arm*", {plat = "linux", arch = "x86_64"})) + t:require_not(_match_patterns("!wasm|!arm*", {plat = "linux", arch = "arm64"})) t:require(_match_patterns("*|x86_64", {plat = "macosx", arch = "x86_64"})) t:require(_match_patterns("macosx|x86_64", {plat = "macosx", arch = "x86_64"})) t:require(_match_patterns("macosx|x86_64,linux|x86_64", {plat = "macosx", arch = "x86_64"})) @@ -119,3 +121,10 @@ function test_plat_arch_subhost_subarch(t) t:require_not(_match_patterns("iphon*|arm64@macosx|x86_64", {plat = "iphoneos", subhost = "linux", arch = "arm64", subarch = "x86_64"})) t:require(_match_patterns("android|native@macosx|x86_64", {plat = "android", subhost = "macosx", arch = "x86_64", subarch = "x86_64"})) end + +function test_logical_expr(t) + t:require(_match_patterns("!wasm|!arm* and !cross|!arm*", {plat = "linux", arch = "x86_64"})) + t:require_not(_match_patterns("!wasm|!arm* and !cross|!arm*", {plat = "linux", arch = "arm64"})) + t:require_not(_match_patterns("!wasm|!arm* and !cross|!arm*", {plat = "wasm", arch = "x86_64"})) +end + |
