You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, I only noticed this after merging #15890 when I worked on some tests. This looks like a regression. In the following file, the code snippet will not be detected and never executed. In a larger file, this could easily lead to mistakes where someone writes a test that seems to succeed.
This "succeeds" on main, but failed with "unexpected error: [invalid-syntax]" before merging pre-#15890 (as it should):
# My test
No newline between prose and code:
```py# A syntax error:;```
While writing a MRE for this bug, I also found this weird behavior which definitely looks like a bug. When the ; in the example above is replaced with §, I get:
thread 'mdtest__binary_integers' panicked at crates/ruff_python_trivia/src/cursor.rs:138:41:
byte index 1 is not a char boundary; it is inside '§' (bytes 0..2) of `§
```
`
The text was updated successfully, but these errors were encountered:
## Summary
Replaces our existing Markdown test parser with a fully hand-written
parser. I tried to fix this bug using the old approach and kept running
into problems. Eventually this seemed like the easier way. It's more
code (+50 lines, excluding the new test), but I hope it's relatively
straightforward to understand, compared to the complex interplay between
the byte-stream-manipulation and regex-parsing that we had before.
I did not really focus on performance, as the parsing time does not
dominate the test execution time, but this seems to be slightly faster
than what we had before (executing all MD tests; debug):
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| this branch | 2.775 ± 0.072 | 2.690 | 2.877 | 1.00 |
| `main` | 2.921 ± 0.034 | 2.865 | 2.967 | 1.05 ± 0.03 |
closes#15923
## Test Plan
One new regression test.
Description
Unfortunately, I only noticed this after merging #15890 when I worked on some tests. This looks like a regression. In the following file, the code snippet will not be detected and never executed. In a larger file, this could easily lead to mistakes where someone writes a test that seems to succeed.
This "succeeds" on main, but failed with "unexpected error: [invalid-syntax]" before merging pre-#15890 (as it should):
While writing a MRE for this bug, I also found this weird behavior which definitely looks like a bug. When the
;
in the example above is replaced with§
, I get:The text was updated successfully, but these errors were encountered: