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

Fix failing tests for invalid control characters in comments #618

Closed

Conversation

jidicula
Copy link
Contributor

@jidicula jidicula commented Oct 5, 2021

Issue: #613

  • Modifies scanComment() to error out early if an illegal character is found
  • Adds illegal characters to scanComment()

Note that the NUL and US control characters weren't causing tests to fail prior to me making my changes... I took a quick look into why but couldn't crack why those tests weren't failing on my machine (TestTOMLTest_Invalid_Control_CommentNull and TestTOMLTest_Invalid_Control_CommentUs). Turns out the codegen used the xNN notation instead of Unicode values for NUL and US control characters. I've modified the testgen file accordingly.

When scanning comments, it makes better sense to halt scanning and
immediately return if an illegal character is encountered while
scanning. This can save on performance in the perverse case of an
extremely long comment that has an early offending character.

Related to: pelletier#613
Previously, the generated tests from toml-test were not failing when
expected for NUL and US control characters. Using the Unicode values
for these tests instead of the \xNN notation corrected this failure.

Related to: pelletier#613
@jidicula jidicula force-pushed the ji/issue-613-comment-invalid-control branch from 1c407d1 to bd5442e Compare October 5, 2021 01:56
@moorereason
Copy link
Contributor

I've offered up a competing PR in #620 that would supersede this offering.

@jidicula jidicula marked this pull request as draft October 6, 2021 01:13
@jidicula jidicula closed this Oct 6, 2021
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