summaryrefslogtreecommitdiff
path: root/gtest/script/exec_with_context.lua
diff options
context:
space:
mode:
author“pengxuanzheng” <[email protected]>2022-07-05 08:41:09 +0000
committer“pengxuanzheng” <[email protected]>2022-07-05 09:02:52 +0000
commite075fb586aa9e72226be6888ded7a2eba72b8cd4 (patch)
treefee7238e7f4dcb7a3a6b3d36051e89dacd5659fa /gtest/script/exec_with_context.lua
parent226e79434842626346ae378f408531d2d19059c7 (diff)
✨ feat(TSG-11123): 增加单元测试,并修改单元测试中发现的错误
Diffstat (limited to 'gtest/script/exec_with_context.lua')
-rw-r--r--gtest/script/exec_with_context.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/gtest/script/exec_with_context.lua b/gtest/script/exec_with_context.lua
new file mode 100644
index 0000000..f7464ba
--- /dev/null
+++ b/gtest/script/exec_with_context.lua
@@ -0,0 +1,19 @@
+local data = TEST.data
+local context = TEST.context
+
+if not context.count then
+ context.count = 1
+else
+ context.count = context.count + 1
+end
+
+if not context.message then
+ context.message = "This is first called"
+else
+ context.message = "This is not first called"
+end
+
+local ud = TEST.get.get_userdata()
+local str = string.format("userdata:%s, context.count:%d, context.message:%s", ud, context.count, context.message)
+
+return string.len( str ), str