From bdc9a4cb46d5dd7d46dfa9a0ab2ec29aa9a2e6a8 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 7 Jan 2025 00:59:53 +0800 Subject: add namespace for task --- tests/apis/namespace/task/.gitignore | 8 ++++++++ tests/apis/namespace/task/test.lua | 5 +++++ tests/apis/namespace/task/xmake.lua | 22 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 tests/apis/namespace/task/.gitignore create mode 100644 tests/apis/namespace/task/test.lua create mode 100644 tests/apis/namespace/task/xmake.lua (limited to 'tests') diff --git a/tests/apis/namespace/task/.gitignore b/tests/apis/namespace/task/.gitignore new file mode 100644 index 000000000..152105761 --- /dev/null +++ b/tests/apis/namespace/task/.gitignore @@ -0,0 +1,8 @@ +# Xmake cache +.xmake/ +build/ + +# MacOS Cache +.DS_Store + + diff --git a/tests/apis/namespace/task/test.lua b/tests/apis/namespace/task/test.lua new file mode 100644 index 000000000..46fa44af3 --- /dev/null +++ b/tests/apis/namespace/task/test.lua @@ -0,0 +1,5 @@ +function main() + os.exec("xmake task0") + os.exec("xmake ns1::task1") + os.exec("xmake ns1::ns2::task2") +end diff --git a/tests/apis/namespace/task/xmake.lua b/tests/apis/namespace/task/xmake.lua new file mode 100644 index 000000000..1f9d13e4a --- /dev/null +++ b/tests/apis/namespace/task/xmake.lua @@ -0,0 +1,22 @@ +task("task0") + set_menu {options = {}} + on_run(function () + print("task0") + end) + +namespace("ns1", function () + task("task1") + set_menu {options = {}} + on_run(function () + print("NS1_TASK1") + end) + + namespace("ns2", function() + task("task2") + set_menu {options = {}} + on_run(function () + print("NS2_TASK2") + end) + end) +end) + -- cgit v1.3.1