File: script_args.lua

package info (click to toggle)
wireshark 4.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 351,352 kB
  • sloc: ansic: 3,102,875; cpp: 129,717; xml: 100,972; python: 56,513; perl: 24,575; sh: 5,874; lex: 4,383; pascal: 4,304; makefile: 166; ruby: 113; objc: 91; tcl: 35
file content (24 lines) | stat: -rw-r--r-- 592 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()