Software /
code /
prosody
Comparison
spec/util_argparse_spec.lua @ 13160:4ee9a912ceea
util.argparse: Add support for repeatable parameters
These are gathered into arrays
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 05 Jan 2022 04:46:27 +0100 |
parent | 12477:cc84682b8429 |
child | 13733:48c056c10e5a |
comparison
equal
deleted
inserted
replaced
13159:706f7d1affc2 | 13160:4ee9a912ceea |
---|---|
48 assert.falsy(opts); | 48 assert.falsy(opts); |
49 assert.equal("param-not-found", err); | 49 assert.equal("param-not-found", err); |
50 assert.equal("-h", where, "returned where"); | 50 assert.equal("-h", where, "returned where"); |
51 end); | 51 end); |
52 | 52 |
53 it("supports array arguments", function () | |
54 local opts, err = parse({ "--item"; "foo"; "--item"; "bar" }, { array_params = { item = true } }); | |
55 assert.falsy(err); | |
56 assert.same({"foo","bar"}, opts.item); | |
57 end) | |
53 end); | 58 end); |