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

disallow unrecognized escapes in unescape_string (part of #21284) #27238

Merged
merged 2 commits into from
May 28, 2018

Conversation

digital-carver
Copy link
Contributor

Throw an error when encountering unknown/unrecognized escape sequences in unescape_string (currently unrecognized single letter sequences like \m, \j, etc. are silently replaced by their corresponding character (m, j, ...) by unescape_string).

This seems to have been the intention behind test changes in #22800, and it will make fixing things like #27125 easier.

@ararslan ararslan added domain:strings "Strings!" needs tests Unit tests are required for this change labels May 23, 2018
@digital-carver
Copy link
Contributor Author

Added tests for the new changes. Realized a bug in the original commit regarding \ and " characters, fixed it.

In adding further tests to catch such bugs in the future, came across a pre-existing test (@test repr(ch) == "'$(isprint(ch) ? ch : st)'") that would fail for the \ character (afaict it should have been failing anyway, except that it wasn't being tested with \ as ch). Fixed that by changing it to @test repr(ch) == "'$(isprint(ch) && ch != '\\' ? ch : st)'", but I'm not sure if that's the right way to go about it or if it's too ad-hoc. In any case, the tests successfully pass (locally) with these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:strings "Strings!" needs tests Unit tests are required for this change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants