diff options
| author | “pengxuanzheng” <[email protected]> | 2022-07-19 07:00:35 +0000 |
|---|---|---|
| committer | “pengxuanzheng” <[email protected]> | 2022-07-19 07:36:03 +0000 |
| commit | a51a298b5a7e5067873b7854687b3ead6d13d8b7 (patch) | |
| tree | 9c60776971d58be129e53a64131b9095b19ba5ce /gtest | |
| parent | ed86120fa4072ce922550ae1304e889e15694ef6 (diff) | |
✨ feat(TSG-11154): 增加remove命令,可以用来移除特定的lua API
Diffstat (limited to 'gtest')
| -rw-r--r-- | gtest/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | gtest/gtest_lua_remove_cmd.cpp | 17 | ||||
| -rw-r--r-- | gtest/script/remove_print.lua | 5 |
3 files changed, 23 insertions, 1 deletions
diff --git a/gtest/CMakeLists.txt b/gtest/CMakeLists.txt index fda6e7d..58b0efa 100644 --- a/gtest/CMakeLists.txt +++ b/gtest/CMakeLists.txt @@ -11,7 +11,7 @@ link_libraries(tsglua gtest gtest_main pthread) add_definitions(-g -W -Wall) add_executable(gtest_tsg_lua ${SRCS}) -#add_executable(gtest_tsg_lua_exec_with_context ./gtest_tsg_lua_exec_with_context.cpp) +# add_executable(gtest_lua_remove_cmd ./gtest_lua_remove_cmd.cpp) add_dependencies(gtest_tsg_lua ${lib_name}_shared gtest) #target_link_libraries(gtest_tsg_lua tsglua gtest gtest_main pthread) diff --git a/gtest/gtest_lua_remove_cmd.cpp b/gtest/gtest_lua_remove_cmd.cpp new file mode 100644 index 0000000..df0c5f1 --- /dev/null +++ b/gtest/gtest_lua_remove_cmd.cpp @@ -0,0 +1,17 @@ +#include <gtest/gtest.h> +#include "tsg_lua_interface.h" + +TEST(lua_remove_cmd, normal) +{ + tsg_lua_handle L = tsg_lua_vm_create_with_name("TEST"); + ASSERT_TRUE(L); + + lua_remove_cmd(L, "print"); + + char out[1204]; + size_t len = 1024; + size_t type = STRING; + int ret = tsg_lua_exec_file(L, "./script/remove_print.lua", "remove print", strlen("remove print"), out, &len, &type); + EXPECT_EQ(ret, ERR_SCRIPT_EXEC_ERROR); + +}
\ No newline at end of file diff --git a/gtest/script/remove_print.lua b/gtest/script/remove_print.lua new file mode 100644 index 0000000..1fc5dd8 --- /dev/null +++ b/gtest/script/remove_print.lua @@ -0,0 +1,5 @@ +local data = TSG.data + +print(data) + +return string.len(data), data
\ No newline at end of file |
