diff options
| author | ruki <[email protected]> | 2017-05-26 09:46:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-26 09:46:18 +0800 |
| commit | 27887740f2be1e2381511632a44b16f2dcddbc49 (patch) | |
| tree | bdec3bd3b0f54aa715046b0e2e0497577915fccf /tests | |
| parent | e5207e47e6b5811f4386d42120b804f740d442c2 (diff) | |
improve xxx_script to support pattern match
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/apis/add_xxx/test.lua | 3 | ||||
| -rw-r--r-- | tests/apis/add_xxx/xmake.lua | 11 | ||||
| -rw-r--r-- | tests/apis/xxx_script/test.lua | 9 | ||||
| -rw-r--r-- | tests/apis/xxx_script/xmake.lua | 26 |
4 files changed, 49 insertions, 0 deletions
diff --git a/tests/apis/add_xxx/test.lua b/tests/apis/add_xxx/test.lua new file mode 100644 index 000000000..a4a38b0ce --- /dev/null +++ b/tests/apis/add_xxx/test.lua @@ -0,0 +1,3 @@ +function main() + os.exec("xmake") +end diff --git a/tests/apis/add_xxx/xmake.lua b/tests/apis/add_xxx/xmake.lua new file mode 100644 index 000000000..80f2ed518 --- /dev/null +++ b/tests/apis/add_xxx/xmake.lua @@ -0,0 +1,11 @@ +add_defines("TEST1") + +target("test") + + add_defines("TEST2") + on_build(function (target) + local defines = table.concat(target:get("defines"), " ") + assert(defines:find("TEST1", 1, true)) + assert(defines:find("TEST2", 1, true)) + end) + diff --git a/tests/apis/xxx_script/test.lua b/tests/apis/xxx_script/test.lua new file mode 100644 index 000000000..bb2762d7d --- /dev/null +++ b/tests/apis/xxx_script/test.lua @@ -0,0 +1,9 @@ +function main() + os.exec("xmake") + if os.host() == "macosx" then + os.exec("xmake f -p iphoneos") + os.exec("xmake") + os.exec("xmake f -p iphoneos -a arm64") + os.exec("xmake") + end +end diff --git a/tests/apis/xxx_script/xmake.lua b/tests/apis/xxx_script/xmake.lua new file mode 100644 index 000000000..d522b11fb --- /dev/null +++ b/tests/apis/xxx_script/xmake.lua @@ -0,0 +1,26 @@ +target("test") + + before_build("iphoneos|arm64", function (target) + assert(vformat("$(plat)") == "iphoneos") + assert(vformat("$(arch)") == "arm64") + end) + + before_build("macosx|.*", function (target) + assert(vformat("$(plat)") == "macosx") + end) + + before_build(function (target) + print("before_build") + end) + + on_build(function (target) + print("build") + end) + + after_build(function (target) + print("after_build") + end) + + after_build("linux|.*", function (target) + assert(vformat("$(plat)") == "linux") + end) |
