summaryrefslogtreecommitdiff
path: root/tests/projects/other/native_module/modules/shared
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-04 00:52:36 +0800
committerruki <[email protected]>2024-04-04 00:52:36 +0800
commit257bbb3fa4a5c2f47f4a9481ea5a6899aac27a2c (patch)
treec2e8e732ab3696cdefe96ce76d7a600ddeed3bf1 /tests/projects/other/native_module/modules/shared
parentc04f30ad9010b58554554f925584ec97682a3f18 (diff)
replace foo tests
Diffstat (limited to 'tests/projects/other/native_module/modules/shared')
-rw-r--r--tests/projects/other/native_module/modules/shared/foo/src/foo.c6
-rw-r--r--tests/projects/other/native_module/modules/shared/foo/xmake.lua3
-rw-r--r--tests/projects/other/native_module/modules/shared/zoo/src/zoo.c26
-rw-r--r--tests/projects/other/native_module/modules/shared/zoo/xmake.lua6
4 files changed, 2 insertions, 39 deletions
diff --git a/tests/projects/other/native_module/modules/shared/foo/src/foo.c b/tests/projects/other/native_module/modules/shared/foo/src/foo.c
index c8ac1c81c..0555b071f 100644
--- a/tests/projects/other/native_module/modules/shared/foo/src/foo.c
+++ b/tests/projects/other/native_module/modules/shared/foo/src/foo.c
@@ -1,6 +1,4 @@
-#include <stdlib.h>
-#include <lua.h>
-#include <lauxlib.h>
+#include <xmi.h>
static int add(lua_State* lua) {
int a = lua_tointeger(lua, 1);
@@ -16,7 +14,7 @@ static int sub(lua_State* lua) {
return 1;
}
-int luaopen_foo(lua_State* lua) {
+int luaopen(foo, lua_State* lua) {
static const luaL_Reg funcs[] = {
{"add", add},
{"sub", sub},
diff --git a/tests/projects/other/native_module/modules/shared/foo/xmake.lua b/tests/projects/other/native_module/modules/shared/foo/xmake.lua
index ad4590ffa..035573d9f 100644
--- a/tests/projects/other/native_module/modules/shared/foo/xmake.lua
+++ b/tests/projects/other/native_module/modules/shared/foo/xmake.lua
@@ -1,9 +1,6 @@
add_rules("mode.debug", "mode.release")
-add_requires("lua 5.4")
-
target("foo")
add_rules("module.shared")
add_files("src/foo.c")
- add_packages("lua")
diff --git a/tests/projects/other/native_module/modules/shared/zoo/src/zoo.c b/tests/projects/other/native_module/modules/shared/zoo/src/zoo.c
deleted file mode 100644
index b297ee302..000000000
--- a/tests/projects/other/native_module/modules/shared/zoo/src/zoo.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <xmi.h>
-
-static int add(lua_State* lua) {
- int a = lua_tointeger(lua, 1);
- int b = lua_tointeger(lua, 2);
- lua_pushinteger(lua, a + b);
- return 1;
-}
-
-static int sub(lua_State* lua) {
- int a = lua_tointeger(lua, 1);
- int b = lua_tointeger(lua, 2);
- lua_pushinteger(lua, a - b);
- return 1;
-}
-
-int luaopen(zoo, lua_State* lua) {
- static const luaL_Reg funcs[] = {
- {"add", add},
- {"sub", sub},
- {NULL, NULL}
- };
- lua_newtable(lua);
- luaL_setfuncs(lua, funcs, 0);
- return 1;
-}
diff --git a/tests/projects/other/native_module/modules/shared/zoo/xmake.lua b/tests/projects/other/native_module/modules/shared/zoo/xmake.lua
deleted file mode 100644
index a74c73637..000000000
--- a/tests/projects/other/native_module/modules/shared/zoo/xmake.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-add_rules("mode.debug", "mode.release")
-
-target("zoo")
- add_rules("module.shared")
- add_files("src/zoo.c")
-