Skip to content

Commit

Permalink
Add tests for multistatement lambda corner case, #326
Browse files Browse the repository at this point in the history
  • Loading branch information
Scony committed Sep 19, 2024
1 parent 9c29fca commit 9779049
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends Node

func _ready() -> void:
get_tree().create_timer(1.0).timeout.connect(
func():
print("Hello world!")
print("This is a bug test.")
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends Node


func _ready() -> void:
(
get_tree()
. create_timer(1.0)
. timeout
. connect(
func():
print("Hello world!")
print("This is a bug test.")
)
)
2 changes: 2 additions & 0 deletions tests/formatter/test_input_output_pairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
[
# TODO: fix
"inline_lambdas_w_comments",
# Desired yet not possible to support due to Godot bug:
"bug_326_multistatement_lambda_corner_case",
]
) # type: Set[str]

Expand Down
2 changes: 2 additions & 0 deletions tests/formatter/test_scripts_validity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
DATA_DIR = "./input-output-pairs"
EXCEPTIONS = set(
[
# Godot bugs:
"bug_326_multistatement_lambda_corner_case.out.gd",
# cases where Godot does more than just parsing
"inline_lambdas_w_comments.in.gd",
"inline_lambdas_w_comments.out.gd",
Expand Down
3 changes: 3 additions & 0 deletions tests/parser/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def pytest_generate_tests(metafunc):

@pytest.mark.parser
def test_parsing_success(gdscript_ok_path):
# TODO: fix lexer
if "bug_326_multistatement_lambda_corner_case" in gdscript_ok_path:
return
with open(gdscript_ok_path, "r", encoding="utf-8") as handle:
code = handle.read()
parser.parse(code) # just checking if not throwing
Expand Down

0 comments on commit 9779049

Please sign in to comment.