2017-05-18 14:57:04 +00:00
|
|
|
package json
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestParse_nonObject(t *testing.T) {
|
|
|
|
src := `true`
|
|
|
|
file, diags := Parse([]byte(src), "")
|
|
|
|
if len(diags) != 1 {
|
|
|
|
t.Errorf("got %d diagnostics; want 1", len(diags))
|
|
|
|
}
|
2017-05-20 20:32:12 +00:00
|
|
|
if file == nil {
|
|
|
|
t.Errorf("got nil File; want actual file")
|
|
|
|
}
|
|
|
|
if file.Body == nil {
|
|
|
|
t.Fatalf("got nil Body; want actual body")
|
|
|
|
}
|
|
|
|
if file.Body.(*body).obj == nil {
|
|
|
|
t.Errorf("got nil Body object; want placeholder object")
|
2017-05-18 14:57:04 +00:00
|
|
|
}
|
|
|
|
}
|