def test_parse_escaped_strings(self): text = r''' string a = "Hello \"world\"" string b = "Hello \"world\"\\" int c = 8; ''' file_parser = FileParser() result, _ = file_parser._parse_strings_comments(text) self.assertEqual(r'"Hello \"world\""', result[0].content) self.assertEqual(r'"Hello \"world\"\\"', result[1].content)
def test_parse_escaped_strings2(self): text = r'''cout << " \"" << (char *)testSet[i].input << '\"';''' file_parser = FileParser() result, _ = file_parser._parse_strings_comments(text) self.assertEqual(r'" \""', result[0].content) self.assertEqual(r"'\"'", result[1].content)