summaryrefslogtreecommitdiffstats
path: root/test/lua/script_args.lua
diff options
context:
space:
mode:
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 0000000..56ca3fb
--- /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()