Skip to content

Commit

Permalink
fix : bug related to docstring and test added
Browse files Browse the repository at this point in the history
  • Loading branch information
kugesan1105 committed Oct 14, 2024
1 parent 4013fc0 commit 822051c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
7 changes: 3 additions & 4 deletions jac/jaclang/compiler/absyntree.py
Original file line number Diff line number Diff line change
Expand Up @@ -4278,10 +4278,9 @@ def lit_value(self) -> str:
elif self.value.startswith(("'", '"')):
repr_str = self.value.encode().decode("unicode_escape")
if (
self.value.startswith('"""')
and self.value.endswith('"""')
and not self.find_parent_of_type(FString)
):
(self.value.startswith('"""') and self.value.endswith('"""'))
or (self.value.startswith("'''") and self.value.endswith("'''"))
) and not self.find_parent_of_type(FString):
return repr_str[3:-3]
if (not self.find_parent_of_type(FString)) or (
not (
Expand Down
2 changes: 2 additions & 0 deletions jac/jaclang/compiler/passes/main/tests/fixtures/fstrings.jac
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ with entry {
len(f_s1), len(f_s2)
) ;
"""sdfsdf\nsdfsdfsdfsd dffgdfgd.""" ;
c1 = '''hello klkl"""''';
print(c1) ;
}
can func() {;
}
1 change: 1 addition & 0 deletions jac/jaclang/tests/test_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def test_fstring_multiple_quotation(self) -> None:
self.assertEqual(stdout_value.split("\n")[0], "11 13 12 12 11 12 12")
self.assertEqual(stdout_value.split("\n")[1], '12 12 """hello""" 18 18')
self.assertEqual(stdout_value.split("\n")[2], "11 12 11 12 11 18 23")
self.assertEqual(stdout_value.split("\n")[3], 'hello klkl"""')

def test_deep_imports(self) -> None:
"""Parse micro jac file."""
Expand Down

0 comments on commit 822051c

Please sign in to comment.