(t *testing.T)
| 1025 | } |
| 1026 | |
| 1027 | func TestAttributeNameErrors(t *testing.T) { |
| 1028 | tests := []struct { |
| 1029 | in string |
| 1030 | err error |
| 1031 | }{ |
| 1032 | {in: "{ . foo }", err: newParseError("syntax error: unexpected END_ATTRIBUTE, expecting IDENTIFIER", 1, 3)}, |
| 1033 | {in: `{ . "foo" }`, err: newParseError("syntax error: unexpected END_ATTRIBUTE, expecting IDENTIFIER", 1, 3)}, |
| 1034 | {in: "{ .foo .bar }", err: newParseError("syntax error: unexpected .", 1, 8)}, |
| 1035 | {in: "{ parent. }", err: newParseError("syntax error: unexpected END_ATTRIBUTE, expecting IDENTIFIER or resource. or span.", 0, 3)}, |
| 1036 | {in: ".3foo", err: newParseError("syntax error: unexpected IDENTIFIER", 1, 3)}, |
| 1037 | {in: `{ ."foo }`, err: newParseError(`unexpected EOF, expecting "`, 0, 3)}, |
| 1038 | } |
| 1039 | |
| 1040 | for _, tc := range tests { |
| 1041 | t.Run(tc.in, func(t *testing.T) { |
| 1042 | _, err := Parse(tc.in) |
| 1043 | |
| 1044 | require.Equal(t, tc.err, err) |
| 1045 | }) |
| 1046 | } |
| 1047 | } |
| 1048 | |
| 1049 | // TestBinaryAndUnaryOperationsRewrites tests code in the newBinaryOperation and newUnaryOperation functions |
| 1050 | // that attempts to simplify combinations of static values where possible. |
nothing calls this directly
no test coverage detected