| 1106 | } |
| 1107 | |
| 1108 | func TestParseNotAtom(t *testing.T) { |
| 1109 | tests := []struct { |
| 1110 | name string |
| 1111 | str string |
| 1112 | }{ |
| 1113 | {name: "constant", str: "/foo"}, |
| 1114 | {name: "number", str: "42"}, |
| 1115 | {name: "variable", str: "X"}, |
| 1116 | {name: "list", str: "[1, 2]"}, |
| 1117 | {name: "empty list", str: "[]"}, |
| 1118 | {name: "map", str: "[/a : /b]"}, |
| 1119 | {name: "struct", str: "{ /a : /b }"}, |
| 1120 | {name: "fn application (not predicate atom)", str: "fn:list(1, 2)"}, |
| 1121 | } |
| 1122 | for _, tt := range tests { |
| 1123 | t.Run(tt.name, func(t *testing.T) { |
| 1124 | if got, err := Atom(tt.str); err == nil { |
| 1125 | t.Errorf("Atom(%q) = %v; want error", tt.str, got) |
| 1126 | } |
| 1127 | }) |
| 1128 | } |
| 1129 | } |