Test runner can't parse CRLF in some cases
dfgordon opened this issue · comments
dfgordon commented
Problem
If the test has the :error
attribute and the test file uses CRLF line endings, the test will report failure incorrectly. Other attributes are also likely affected by the bug. The programmer of the tests may not figure out the line separators are the problem for some time. This appears to come from the following loop in cli/src/test.rs
, maybe just tweak the closure:
for line in test_name_and_markers
.split(|&c| c == b'\n')
.filter(|s| !s.is_empty())
{
// ...
}
Steps to reproduce
Add :error
to a unit test that has an error deliberately introduced. Change line separators to CRLF. Run tree-sitter test
.
Expected behavior
Expect test runner to be able to parse either standard line separator.
Tree-sitter version (tree-sitter --version)
tree-sitter 0.22.2
Operating system/version
Windows 11