MCPcopy
hub / github.com/caddyserver/caddy / TestParseVariadic

Function TestParseVariadic

caddyconfig/caddyfile/parse_test.go:25–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestParseVariadic(t *testing.T) {
26 args := make([]string, 10)
27 for i, tc := range []struct {
28 input string
29 result bool
30 }{
31 {
32 input: "",
33 result: false,
34 },
35 {
36 input: "{args[1",
37 result: false,
38 },
39 {
40 input: "1]}",
41 result: false,
42 },
43 {
44 input: "{args[:]}aaaaa",
45 result: false,
46 },
47 {
48 input: "aaaaa{args[:]}",
49 result: false,
50 },
51 {
52 input: "{args.}",
53 result: false,
54 },
55 {
56 input: "{args.1}",
57 result: false,
58 },
59 {
60 input: "{args[]}",
61 result: false,
62 },
63 {
64 input: "{args[:]}",
65 result: true,
66 },
67 {
68 input: "{args[:]}",
69 result: true,
70 },
71 {
72 input: "{args[0:]}",
73 result: true,
74 },
75 {
76 input: "{args[:0]}",
77 result: true,
78 },
79 {
80 input: "{args[-1:]}",
81 result: false,
82 },

Callers

nothing calls this directly

Calls 1

parseVariadicFunction · 0.85

Tested by

no test coverage detected