Closed TRCYX closed 1 year ago
Thanks! Any chance of a few tests that include these cases? This seems like code that's easy to accidentally break.
Where should I put them? In examples
or as cargo tests?
I think unit tests at the bottom of the same file would be fine, like:
#[cfg(test)]
mod tests {
#[test]
fn foo() {
...
}
}
Thanks for the idea of tests. The original code was wrong in the len
field of a Line
ending with CRLF, neglecting the LF. To solve this problem the code becomes considerably uglier :)
Tests are added and I force-pushed to keep the history clean.
Thanks for the idea of tests. The original code was wrong in the
len
field of aLine
ending with CRLF, neglecting the LF. To solve this problem the code becomes considerably uglier :)
Hehe, I suspected as much. Logic like this is often surprisingly difficult to get right. I feel much more comfortable merging this with tests!
Corresponds to Section 5.8 of the Unicode Standard, as well as
chumsky::text::newline
.