Skip to content

Commit 1dd4cd5

Browse files
committed
Bring back formatter's docstring tests
1 parent a12dff3 commit 1dd4cd5

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

gdtoolkit/formatter/class_statement.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ def _format_var_statement(statement: Tree, context: Context) -> Outcome:
144144

145145
def _format_docstring_statement(statement: Tree, context: Context) -> Outcome:
146146
expression_context = ExpressionContext("", statement.line, "", statement.end_line)
147-
return format_expression(statement.children[0], expression_context, context)
147+
return format_concrete_expression(
148+
statement.children[0], expression_context, context
149+
)
148150

149151

150152
def _format_class_statement(statement: Tree, context: Context) -> Outcome:

tests/formatter/input-output-pairs/strings.in.gd

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,19 @@ var x9 = '''x'''
1313
var x10 = '''x "'''
1414

1515
var x11 = """abc " def ' ghi"""
16+
17+
'x'
18+
19+
'x "'
20+
'x " " \''
21+
"x '"
22+
"x ' ' \""
23+
24+
'x \''
25+
"x \""
26+
'x \' "'
27+
28+
'''x'''
29+
'''x "'''
30+
31+
"""abc " def ' ghi"""

tests/formatter/input-output-pairs/strings.out.gd

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,19 @@ var x9 = "x"
1313
var x10 = 'x "'
1414

1515
var x11 = """abc " def ' ghi"""
16+
17+
"x"
18+
19+
'x "'
20+
'x " " \''
21+
"x '"
22+
"x ' ' \""
23+
24+
"x '"
25+
'x "'
26+
"x ' \""
27+
28+
"x"
29+
'x "'
30+
31+
"""abc " def ' ghi"""

0 commit comments

Comments
 (0)