MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestParseError

Function TestParseError

policy/parser_test.go:45–236  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func TestParseError(t *testing.T) {
46 tests := []struct {
47 txt string
48 err string
49 }{
50 {
51 txt: `
52name:
53 illegal: yaml-type`,
54 err: `ERROR: <input>:3:3: got yaml node type tag:yaml.org,2002:map, wanted type(s) [tag:yaml.org,2002:str !txt]
55 | illegal: yaml-type
56 | ..^`,
57 },
58 {
59 txt: `
60rule:
61 custom: yaml-type`,
62 err: `ERROR: <input>:3:3: unsupported rule tag: custom
63 | custom: yaml-type
64 | ..^`,
65 },
66 {
67 txt: `
68inputs:
69 - name: a
70 - name: b`,
71 err: `ERROR: <input>:2:1: unsupported policy tag: inputs
72 | inputs:
73 | ^`,
74 },
75 {
76 txt: `
77rule:
78 variables:
79 - name: "true"
80 alt_name: "bool_true"`,
81 err: `ERROR: <input>:5:7: unsupported variable tag: alt_name
82 | alt_name: "bool_true"
83 | ......^`,
84 },
85 {
86 txt: `
87rule:
88 match:
89 - name: "true"
90 alt_name: "bool_true"`,
91 err: `ERROR: <input>:4:7: unsupported match tag: name
92 | - name: "true"
93 | ......^
94ERROR: <input>:4:7: match does not specify a rule or output
95 | - name: "true"
96 | ......^
97ERROR: <input>:5:7: unsupported match tag: alt_name
98 | alt_name: "bool_true"
99 | ......^`,
100 },
101 {
102 txt: `

Callers

nothing calls this directly

Calls 5

ParseMethod · 0.95
StringSourceFunction · 0.85
ErrMethod · 0.80
NewParserFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected