gh-100445: Improve error message for unterminated strings with escapes (#100446)

This commit is contained in:
Shantanu 2023-10-18 05:58:51 -07:00 committed by GitHub
parent baefbb21d9
commit 3156d193b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 4 deletions

View file

@ -2298,8 +2298,14 @@ func(
def test_error_string_literal(self):
self._check_error("'blech", "unterminated string literal")
self._check_error('"blech', "unterminated string literal")
self._check_error("'blech", r"unterminated string literal \(.*\)$")
self._check_error('"blech', r"unterminated string literal \(.*\)$")
self._check_error(
r'"blech\"', r"unterminated string literal \(.*\); perhaps you escaped the end quote"
)
self._check_error(
r'r"blech\"', r"unterminated string literal \(.*\); perhaps you escaped the end quote"
)
self._check_error("'''blech", "unterminated triple-quoted string literal")
self._check_error('"""blech', "unterminated triple-quoted string literal")