Merge pull request #2224 from tree-sitter/fix-tests
Fix tests, adapt to `tree-sitter-json` latest changes
This commit is contained in:
commit
46ea3e3e8c
2 changed files with 42 additions and 17 deletions
|
|
@ -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]
|
||||
|
|
|
|||
54
test/fixtures/error_corpus/json_errors.txt
vendored
54
test/fixtures/error_corpus/json_errors.txt
vendored
|
|
@ -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')))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue