Commit graph

26 commits

Author SHA1 Message Date
marceloll
0f5563c536 Add test for ; comments 2021-01-08 13:28:40 -03:00
marceloll
9500aff052 Use ; as comment in tests segxp section 2021-01-08 13:28:40 -03:00
Max Brunsfeld
96f259d8c5 Run rustfmt 2020-12-03 09:48:20 -08:00
Max Brunsfeld
026231e93d Merge branch 'master' into HEAD 2020-12-03 09:44:33 -08:00
Max Brunsfeld
518916f221 Return correct path and line in query errors from the CLI 2020-09-24 13:47:27 -07:00
Max Brunsfeld
49c632ae90 Fix error in test command when queries folder does not exist
Fixes #468
2019-10-21 09:22:24 -07:00
Max Brunsfeld
e14e285a10 cli: Check queries when running tree-sitter test 2019-10-18 14:44:16 -07:00
Ika
f191858bae fix: handle UNEXPECTED node 2019-10-03 21:24:17 +08:00
Ika
d88dae7a3e feat(cli): support snapshot testing with --update flag
This PR adds an `--update` flag to the `tree-sitter test` command, which adds the ability to replace the _expected_ output in the corpus.txt with the _actual_ output produced by the parser, that is, we can now simply use this `--update` flag to write all the corresponding parser output back to the corpus.txt, and we just need to check the output without typing its actual sexp.

- use the same output format as `tree-sitter parse`, except there won't be any position information printed.
- the corpus.txt won't be touched if there's no difference between the _expected_ output and the _actual_ output in that file.
- if there're differences between _expected_ and _actual_, _expected_ will be replaced by _actual_ and the whole file will be reformatted, i.e., all the output sexp will be formatted just like the output from `tree-sitter parse` and all the delimiters `===`/`---` will be normalized as 80-column long.
- this flag also works with `--filter` flag.
2019-09-06 10:57:59 +08:00
Max Brunsfeld
a8dedbee0d In test command, use the longest line of dashes as the test divider 2019-09-05 09:59:59 -07:00
Rob Donnelly
9ba5f25594 Ignore hidden files in grammar test directories (#430)
This fixes "stream did not contain valid UTF-8" error due to
`tree-sitter test` attempting to Vim's parse hidden binary swap files.
2019-08-19 09:03:12 -07:00
Max Brunsfeld
bd466febb4 highlight: Fix panic when cancelled before parsing a nested document 2019-07-16 14:34:24 -07:00
Max Brunsfeld
d274e81d0d Overhaul CLI error handling to allow multiple levels of context 2019-05-30 16:52:55 -07:00
Max Brunsfeld
65d1ce8593 lib: Include fields in ts_node_string output
This allows you to assert about fields in tests. But if your test 
s-expression does *not* include fields, the fields will be stripped from 
the regexp before comparison.
2019-02-13 09:47:21 -08:00
Max Brunsfeld
50281637d7 binding: Make parse methods more convenient
* Rename parse_str to parse and make it polymorphic.
* Rename parse_utf8 to parse_with, since it is now the callback-based
  version of parse
* Add a parse_utf16 method analogous to parse
* Rename existing parse_utf16 method to parse_utf16_with

This brings in the changes from tree-sitter/rust-tree-sitter#5
2019-02-05 10:59:33 -08:00
Max Brunsfeld
59f7511b1c Fix test command's exit code 2019-02-04 09:12:25 -08:00
Max Brunsfeld
4cac85fec4 Add benchmark script
* Structure `cli` crate as both a library and an executable, so that
benchmarks can import code from the crate.
* Import macros in the Rust 2018 style.
2019-02-01 15:17:35 -08:00
Max Brunsfeld
6d8ef48dad Make test subcommand exit 1 if tests fail 2019-01-27 09:53:49 -08:00
Max Brunsfeld
233d616ebf Add random mutation tests 2019-01-25 12:05:21 -08:00
Max Brunsfeld
3d11388cd1 Fix test subcommand bugs
* Log session was dropped before the parser
* Whitespace between close parens was not stripped
2019-01-17 12:40:21 -08:00
Max Brunsfeld
d8ab36b2a5 Fix bugs in handling tokens that overlap with separators 2019-01-15 13:21:48 -08:00
Max Brunsfeld
5c3c1dd0bd Get logging flags working properly with test script 2019-01-15 13:21:48 -08:00
Max Brunsfeld
0d85a1ef53 Exclude final newlines from inputs when parsing corpus files 2019-01-11 09:48:45 -08:00
Max Brunsfeld
98807d2053 Add debug and debug-graph flags to parse and test commands 2019-01-08 21:03:51 -08:00
Max Brunsfeld
6c4d00aad5 Print diffs when tests fail 2019-01-07 22:01:40 -08:00
Max Brunsfeld
8291d294fb Add test subcommand
Co-Authored-By: Timothy Clem <timothy.clem@gmail.com>
2019-01-07 17:57:27 -08:00