summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-03 23:30:46 +0800
committerruki <[email protected]>2021-01-03 23:30:46 +0800
commita9bd137d0b0770fed55f4486edca3b733dd28161 (patch)
tree59ac20af84ec4543af770252437bcf3a2f87041e /tests
parent9369492d97fd8a6bf50e147daa046a5c182d6f6a (diff)
improve tests
Diffstat (limited to 'tests')
-rw-r--r--tests/projects/package/depconfigs/xmake.lua36
1 files changed, 21 insertions, 15 deletions
diff --git a/tests/projects/package/depconfigs/xmake.lua b/tests/projects/package/depconfigs/xmake.lua
index d18fee519..7c616eef5 100644
--- a/tests/projects/package/depconfigs/xmake.lua
+++ b/tests/projects/package/depconfigs/xmake.lua
@@ -11,13 +11,15 @@ target("test")
add_files("src/*.c")
add_packages("libpng")
before_build(function (target)
- local found
- for _, linkdir in ipairs(target:pkg("libpng"):get("linkdirs")) do
- if linkdir:find("zlib/1.2.10", 1, true) then
- found = true
+ if target:pkg("libpng") then
+ local found
+ for _, linkdir in ipairs(target:pkg("libpng"):get("linkdirs")) do
+ if linkdir:find("zlib[/\\]1%.2%.10") then
+ found = true
+ end
end
+ assert(found, "package(zlib 1.2.10) not found!")
end
- assert(found, "package(zlib 1.2.10) not found!")
end)
target("test2")
@@ -25,13 +27,15 @@ target("test2")
add_files("src/*.c")
add_packages("libtiff")
before_build(function (target)
- local found
- for _, linkdir in ipairs(target:pkg("libtiff"):get("linkdirs")) do
- if linkdir:find("zlib", 1, true) then
- found = true
+ if target:pkg("libtiff") then
+ local found
+ for _, linkdir in ipairs(target:pkg("libtiff"):get("linkdirs")) do
+ if linkdir:find("zlib", 1, true) then
+ found = true
+ end
end
+ assert(found, "package(zlib) not found!")
end
- assert(found, "package(zlib) not found!")
end)
target("test3")
@@ -39,11 +43,13 @@ target("test3")
add_files("src/*.c")
add_packages("libwebp")
before_build(function (target)
- local found
- for _, linkdir in ipairs(target:pkg("libwebp"):get("linkdirs")) do
- if linkdir:find("zlib", 1, true) then
- found = true
+ if target:pkg("libwebp") then
+ local found
+ for _, linkdir in ipairs(target:pkg("libwebp"):get("linkdirs")) do
+ if linkdir:find("zlib", 1, true) then
+ found = true
+ end
end
+ assert(found, "package(zlib) not found!")
end
- assert(found, "package(zlib) not found!")
end)