| 13 | ) |
| 14 | |
| 15 | func TestParse_nonObject(t *testing.T) { |
| 16 | src := `true` |
| 17 | file, diags := Parse([]byte(src), "") |
| 18 | if len(diags) != 1 { |
| 19 | t.Errorf("got %d diagnostics; want 1", len(diags)) |
| 20 | } |
| 21 | if file == nil { |
| 22 | t.Fatalf("got nil File; want actual file") |
| 23 | } |
| 24 | if file.Body == nil { |
| 25 | t.Fatalf("got nil Body; want actual body") |
| 26 | } |
| 27 | if file.Body.(*body).val == nil { |
| 28 | t.Errorf("got nil Body object; want placeholder object") |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | func TestParseTemplate(t *testing.T) { |
| 33 | src := `{"greeting": "hello ${\"world\"}"}` |