Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more newlines #64

Merged
merged 1 commit into from
Feb 7, 2023
Merged

Support more newlines #64

merged 1 commit into from
Feb 7, 2023

Conversation

TRCYX
Copy link
Contributor

@TRCYX TRCYX commented Jan 26, 2023

Corresponds to Section 5.8 of the Unicode Standard, as well as chumsky::text::newline.

@zesterer
Copy link
Owner

zesterer commented Feb 2, 2023

Thanks! Any chance of a few tests that include these cases? This seems like code that's easy to accidentally break.

@TRCYX
Copy link
Contributor Author

TRCYX commented Feb 2, 2023

Where should I put them? In examples or as cargo tests?

@zesterer
Copy link
Owner

zesterer commented Feb 2, 2023

I think unit tests at the bottom of the same file would be fine, like:

#[cfg(test)]
mod tests {
    #[test]
    fn foo() {
        ...
    }
}

Corresponds to Section 5.8 of the Unicode Standard, as well as `chumsky::text::newline`.
@TRCYX
Copy link
Contributor Author

TRCYX commented Feb 2, 2023

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 :)

@TRCYX
Copy link
Contributor Author

TRCYX commented Feb 2, 2023

Tests are added and I force-pushed to keep the history clean.

@zesterer
Copy link
Owner

zesterer commented Feb 6, 2023

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 :)

Hehe, I suspected as much. Logic like this is often surprisingly difficult to get right. I feel much more comfortable merging this with tests!

@zesterer zesterer merged commit 7671c53 into zesterer:main Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants