End a raw string at its first closing quote by regex
CI / tests (pull_request) Failing after 5m36s

This commit is contained in:
2026-11-26 00:53:45 +01:00
parent 6719d10034
commit 347368040e
2 changed files with 6 additions and 3 deletions
+4
View File
@@ -77,6 +77,10 @@ class ModulesTest(unittest.TestCase):
source = "#[cfg(test)]\nmod tests {\n const A: &str = r\"\\\";\n}\nfn after() {}\n"
self.assertEqual(list(spelt(source)), ["tests"])
def test_ends_a_raw_string_at_its_first_closing_quote(self):
source = "#[cfg(test)]\nmod tests {\n const A: &str = r#\"x\"#;\n}\nconst B: &str = r#\"y\"#;\n"
self.assertEqual(list(spelt(source)), ["tests"])
def test_reads_a_string_that_ends_in_two_backslashes_or_in_an_escaped_quote(self):
for literal in ('"\\\\"', '"a\\""', '"\\}\\}"'):
with self.subTest(literal=literal):