diff --git a/cli/src/tests/parser_test.rs b/cli/src/tests/parser_test.rs index 78c6cda4..f06d88b8 100644 --- a/cli/src/tests/parser_test.rs +++ b/cli/src/tests/parser_test.rs @@ -276,7 +276,10 @@ fn test_parsing_invalid_chars_at_eof() { let mut parser = Parser::new(); parser.set_language(get_language("json")).unwrap(); let tree = parser.parse(b"\xdf", None).unwrap(); - assert_eq!(tree.root_node().to_sexp(), "(ERROR (UNEXPECTED INVALID))"); + assert_eq!( + tree.root_node().to_sexp(), + "(document (ERROR (UNEXPECTED INVALID)))" + ); } #[test] diff --git a/test/fixtures/error_corpus/json_errors.txt b/test/fixtures/error_corpus/json_errors.txt index 53ce94e4..065fa88c 100644 --- a/test/fixtures/error_corpus/json_errors.txt +++ b/test/fixtures/error_corpus/json_errors.txt @@ -6,7 +6,8 @@ top-level errors --- -(ERROR) +(document + (ERROR)) ========================================== unexpected tokens @@ -16,7 +17,9 @@ barf --- -(ERROR (UNEXPECTED 'b')) +(document + (ERROR + (UNEXPECTED 'b'))) ========================================== errors inside arrays @@ -26,10 +29,11 @@ errors inside arrays --- -(document (array - (number) - (ERROR) - (number))) +(document + (array + (number) + (ERROR) + (number))) ========================================== errors inside objects @@ -39,9 +43,14 @@ errors inside objects --- -(document (object - (pair (string (string_content)) (number)) - (ERROR (UNEXPECTED 'o')))) +(document + (object + (pair + (string + (string_content)) + (number)) + (ERROR + (UNEXPECTED 'o')))) ========================================== errors inside nested objects @@ -51,12 +60,23 @@ errors inside nested objects --- -(document (object - (pair (string (string_content)) (object - (pair (string (string_content)) (number)) - (ERROR (number)))) - (pair (string (string_content)) (number)) - (ERROR))) +(document + (object + (pair + (string + (string_content)) + (object + (pair + (string + (string_content)) + (number)) + (ERROR + (number)))) + (pair + (string + (string_content)) + (number)) + (ERROR))) =============================== incomplete tokens at EOF @@ -65,4 +85,6 @@ incomplete tokens at EOF nul --- -(ERROR (UNEXPECTED '\0')) +(document + (ERROR + (UNEXPECTED '\0')))