summaryrefslogtreecommitdiff
path: root/tests/modules/private/select_script/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-03-05 22:44:37 +0800
committerruki <[email protected]>2024-03-05 22:44:37 +0800
commita5e284bd5972a3f85250fa8cd894c4669d086a11 (patch)
treec5454c443767aa7ab59e76e0cebd418bd835cf60 /tests/modules/private/select_script/test.lua
parent69d11ecb1f292694bec66c061ad4c92584e9f7d5 (diff)
add more tests
Diffstat (limited to 'tests/modules/private/select_script/test.lua')
-rw-r--r--tests/modules/private/select_script/test.lua83
1 files changed, 77 insertions, 6 deletions
diff --git a/tests/modules/private/select_script/test.lua b/tests/modules/private/select_script/test.lua
index f1e950dd1..e7efcaa84 100644
--- a/tests/modules/private/select_script/test.lua
+++ b/tests/modules/private/select_script/test.lua
@@ -20,21 +20,92 @@ function test_plat_only(t)
t:require(_match_pattern("!mac*", {plat = "linux"}))
end
-function test_arch_only(t)
-end
-
function test_plat_arch(t)
+ t:require(_match_pattern("*|x86_64", {plat = "macosx", arch = "x86_64"}))
+ t:require(_match_pattern("macosx|x86_64", {plat = "macosx", arch = "x86_64"}))
+ t:require(_match_pattern("macosx|x86_64,linux|x86_64", {plat = "macosx", arch = "x86_64"}))
+ t:require(_match_pattern("macosx|x86_*", {plat = "macosx", arch = "x86_64"}))
+ t:require_not(_match_pattern("macosx|x86_64", {plat = "linux", arch = "x86_64"}))
+ t:require_not(_match_pattern("macosx|i386", {plat = "macosx", arch = "x86_64"}))
+ t:require_not(_match_pattern("!macosx|x86_64", {plat = "macosx", arch = "x86_64"}))
+ t:require_not(_match_pattern("!mac*|x86_64", {plat = "macosx", arch = "x86_64"}))
+ t:require(_match_pattern("!macosx|x86_64", {plat = "linux", arch = "x86_64"}))
+ t:require(_match_pattern("!mac*|x86_64", {plat = "linux", arch = "x86_64"}))
+ t:require(_match_pattern("macosx|!i386", {plat = "macosx", arch = "x86_64"}))
+ t:require(_match_pattern("!macosx|!i386", {plat = "linux", arch = "x86_64"}))
+ t:require(_match_pattern("windows|!x86", {plat = "windows", arch = "x64"}))
+-- t:require_not(_match_pattern("windows|!x86", {plat = "android", arch = "arm64-v8a"}))
+ t:require(_match_pattern("macosx|native", {plat = "macosx", arch = "x86_64", subarch = "x86_64"}))
+ t:require(_match_pattern("macosx|!native", {plat = "macosx", arch = "arm64", subarch = "x86_64"}))
+ t:require_not(_match_pattern("macosx|!native", {plat = "macosx", arch = "x86_64", subarch = "x86_64"}))
+ t:require_not(_match_pattern("windows|native", {plat = "macosx", arch = "x86_64", subarch = "x86_64"}))
end
function test_subhost_only(t)
+ t:require(_match_pattern("@*", {subhost = "macosx"}))
+ t:require(_match_pattern("@macosx", {subhost = "macosx"}))
+ t:require(_match_pattern("@macosx,@linux", {subhost = "macosx"}))
+ t:require(_match_pattern("@mac*", {subhost = "macosx"}))
+ t:require_not(_match_pattern("@macosx", {subhost = "linux"}))
+ t:require_not(_match_pattern("@linux", {subhost = "macosx"}))
+ t:require_not(_match_pattern("@!macosx", {subhost = "macosx"}))
+ t:require_not(_match_pattern("@!mac*", {subhost = "macosx"}))
+ t:require(_match_pattern("@!macosx", {subhost = "linux"}))
+ t:require(_match_pattern("@!mac*", {subhost = "linux"}))
end
-function test_subarch_only(t)
+function test_subhost_subarch(t)
+ t:require(_match_pattern("@*|x86_64", {subhost = "macosx", subarch = "x86_64"}))
+ t:require(_match_pattern("@macosx|x86_64", {subhost = "macosx", subarch = "x86_64"}))
+ t:require(_match_pattern("@macosx|x86_64,@linux|x86_64", {subhost = "macosx", subarch = "x86_64"}))
+ t:require(_match_pattern("@macosx|x86_*", {subhost = "macosx", subarch = "x86_64"}))
+ t:require_not(_match_pattern("@macosx|x86_64", {subhost = "linux", subarch = "x86_64"}))
+ t:require_not(_match_pattern("@macosx|i386", {subhost = "macosx", subarch = "x86_64"}))
+ t:require_not(_match_pattern("@!macosx|x86_64", {subhost = "macosx", subarch = "x86_64"}))
+ t:require_not(_match_pattern("@!mac*|x86_64", {subhost = "macosx", subarch = "x86_64"}))
+ t:require(_match_pattern("@!macosx|x86_64", {subhost = "linux", subarch = "x86_64"}))
+ t:require(_match_pattern("@!mac*|x86_64", {subhost = "linux", subarch = "x86_64"}))
+ t:require(_match_pattern("@macosx|!i386", {subhost = "macosx", subarch = "x86_64"}))
+ t:require(_match_pattern("@!macosx|!i386", {subhost = "linux", subarch = "x86_64"}))
+ t:require(_match_pattern("@windows|!x86", {subhost = "windows", subarch = "x64"}))
+-- t:require_not(_match_pattern("@windows|!x86", {subhost = "android", subarch = "arm64-v8a"}))
+ t:require(_match_pattern("@macosx|native", {subhost = "macosx", subarch = "x86_64"}))
+ t:require(_match_pattern("@macosx|native", {subhost = "macosx", subarch = "arm64"}))
+ t:require_not(_match_pattern("@macosx|!native", {subhost = "macosx", subarch = "x86_64"}))
+ t:require_not(_match_pattern("@windows|native", {subhost = "macosx", subarch = "x86_64"}))
end
-function test_subarch_native(t)
+function test_plat_subhost(t)
+ t:require(_match_pattern("*@macosx", {plat = "macosx", subhost = "macosx"}))
+ t:require(_match_pattern("android@macosx", {plat = "android", subhost = "macosx"}))
+ t:require(_match_pattern("android@macosx,linux", {plat = "android", subhost = "linux"}))
+ t:require(_match_pattern("android@mac*", {plat = "android", subhost = "macosx"}))
+ t:require(_match_pattern("android@!macosx", {plat = "android", subhost = "linux"}))
+ t:require_not(_match_pattern("!android@macosx", {plat = "android", subhost = "macosx"}))
+ t:require(_match_pattern("!iphon*@macosx", {plat = "linux", subhost = "macosx"}))
end
-function test_subhost_subarch(t)
+function test_plat_arch_subhost(t)
+ t:require(_match_pattern("*|x86_64@macosx", {plat = "macosx", subhost = "macosx", arch = "x86_64"}))
+ t:require(_match_pattern("android|arm64-v8a@macosx", {plat = "android", subhost = "macosx", arch = "arm64-v8a"}))
+ t:require(_match_pattern("android|x86_64@macosx,linux", {plat = "android", subhost = "linux", arch = "x86_64"}))
+ t:require(_match_pattern("android|x86_64@mac*", {plat = "android", subhost = "macosx", arch = "x86_64"}))
+ t:require(_match_pattern("android|x86_64@!macosx", {plat = "android", subhost = "linux", arch = "x86_64"}))
+ t:require_not(_match_pattern("!android|x86_64@macosx", {plat = "android", subhost = "macosx", arch = "x86_64"}))
+ t:require(_match_pattern("!iphon*|x86_64@macosx", {plat = "linux", subhost = "macosx", arch = "x86_64"}))
+ t:require(_match_pattern("iphon*|arm64@macosx", {plat = "iphoneos", subhost = "macosx", arch = "arm64"}))
+ t:require_not(_match_pattern("iphon*|arm64@macosx", {plat = "iphoneos", subhost = "linux", arch = "arm64"}))
end
+function test_plat_arch_subhost_subarch(t)
+ t:require(_match_pattern("*|x86_64@macosx|x86_64", {plat = "macosx", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
+ t:require(_match_pattern("android|arm64-v8a@macosx|x86_64", {plat = "android", subhost = "macosx", arch = "arm64-v8a", subarch = "x86_64"}))
+ t:require(_match_pattern("android|x86_64@macosx|x86_64,linux|x86_64", {plat = "android", subhost = "linux", arch = "x86_64", subarch = "x86_64"}))
+ t:require(_match_pattern("android|x86_64@mac*|x86_64", {plat = "android", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
+ t:require(_match_pattern("android|x86_64@!macosx|x86_64", {plat = "android", subhost = "linux", arch = "x86_64", subarch = "x86_64"}))
+ t:require_not(_match_pattern("!android|x86_64@macosx|x86_64", {plat = "android", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
+ t:require(_match_pattern("!iphon*|x86_64@macosx|x86_64", {plat = "linux", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
+ t:require(_match_pattern("iphon*|arm64@macosx|x86_64", {plat = "iphoneos", subhost = "macosx", arch = "arm64", subarch = "x86_64"}))
+ t:require_not(_match_pattern("iphon*|arm64@macosx|x86_64", {plat = "iphoneos", subhost = "linux", arch = "arm64", subarch = "x86_64"}))
+-- t:require(_match_pattern("android|native@macosx|x86_64", {plat = "android", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
+end