Skip to content

Commit 9779049

Browse files
committed
Add tests for multistatement lambda corner case, #326
1 parent 9c29fca commit 9779049

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends Node
2+
3+
func _ready() -> void:
4+
get_tree().create_timer(1.0).timeout.connect(
5+
func():
6+
print("Hello world!")
7+
print("This is a bug test.")
8+
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
extends Node
2+
3+
4+
func _ready() -> void:
5+
(
6+
get_tree()
7+
. create_timer(1.0)
8+
. timeout
9+
. connect(
10+
func():
11+
print("Hello world!")
12+
print("This is a bug test.")
13+
)
14+
)

tests/formatter/test_input_output_pairs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
[
1010
# TODO: fix
1111
"inline_lambdas_w_comments",
12+
# Desired yet not possible to support due to Godot bug:
13+
"bug_326_multistatement_lambda_corner_case",
1214
]
1315
) # type: Set[str]
1416

tests/formatter/test_scripts_validity.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
DATA_DIR = "./input-output-pairs"
1111
EXCEPTIONS = set(
1212
[
13+
# Godot bugs:
14+
"bug_326_multistatement_lambda_corner_case.out.gd",
1315
# cases where Godot does more than just parsing
1416
"inline_lambdas_w_comments.in.gd",
1517
"inline_lambdas_w_comments.out.gd",

tests/parser/test_parser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def pytest_generate_tests(metafunc):
3131

3232
@pytest.mark.parser
3333
def test_parsing_success(gdscript_ok_path):
34+
# TODO: fix lexer
35+
if "bug_326_multistatement_lambda_corner_case" in gdscript_ok_path:
36+
return
3437
with open(gdscript_ok_path, "r", encoding="utf-8") as handle:
3538
code = handle.read()
3639
parser.parse(code) # just checking if not throwing

0 commit comments

Comments
 (0)