(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestParseError(t *testing.T) { |
| 46 | tests := []struct { |
| 47 | txt string |
| 48 | err string |
| 49 | }{ |
| 50 | { |
| 51 | txt: ` |
| 52 | name: |
| 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: ` |
| 60 | rule: |
| 61 | custom: yaml-type`, |
| 62 | err: `ERROR: <input>:3:3: unsupported rule tag: custom |
| 63 | | custom: yaml-type |
| 64 | | ..^`, |
| 65 | }, |
| 66 | { |
| 67 | txt: ` |
| 68 | inputs: |
| 69 | - name: a |
| 70 | - name: b`, |
| 71 | err: `ERROR: <input>:2:1: unsupported policy tag: inputs |
| 72 | | inputs: |
| 73 | | ^`, |
| 74 | }, |
| 75 | { |
| 76 | txt: ` |
| 77 | rule: |
| 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: ` |
| 87 | rule: |
| 88 | match: |
| 89 | - name: "true" |
| 90 | alt_name: "bool_true"`, |
| 91 | err: `ERROR: <input>:4:7: unsupported match tag: name |
| 92 | | - name: "true" |
| 93 | | ......^ |
| 94 | ERROR: <input>:4:7: match does not specify a rule or output |
| 95 | | - name: "true" |
| 96 | | ......^ |
| 97 | ERROR: <input>:5:7: unsupported match tag: alt_name |
| 98 | | alt_name: "bool_true" |
| 99 | | ......^`, |
| 100 | }, |
| 101 | { |
| 102 | txt: ` |
nothing calls this directly
no test coverage detected