summaryrefslogtreecommitdiffstats
path: root/test/lua/script_args.lua
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /test/lua/script_args.lua
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/lua/script_args.lua')
-rw-r--r--test/lua/script_args.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/lua/script_args.lua b/test/lua/script_args.lua
new file mode 100644
index 00000000..56ca3fbe
--- /dev/null
+++ b/test/lua/script_args.lua
@@ -0,0 +1,24 @@
+----------------------------------------
+-- This just verifies the number of args it got is what it expected.
+-- The first arg should be a number, for how many total args to expect,
+-- including itself.
+
+local testlib = require("testlib")
+
+local ARGS = "args"
+testlib.init({ [ARGS]=3 })
+
+-----------------------------
+
+testlib.testing("Command-line args")
+
+local arg={...} -- get passed-in args
+
+testlib.test(ARGS, "arg1", arg ~= nil and #arg > 0)
+
+local numargs = tonumber(arg[1])
+testlib.test(ARGS, "arg2", numargs ~= nil)
+
+testlib.test(ARGS, "arg3", #arg == numargs)
+
+testlib.getResults()