-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for simple multiline lambdas
- Loading branch information
Showing
7 changed files
with
142 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import os | ||
import subprocess | ||
import shutil | ||
|
||
import pytest | ||
from gdtoolkit.parser import parser | ||
|
||
from ..common import GODOT_SERVER, write_project_settings, write_file | ||
|
||
|
||
OK_DATA_DIR = "../valid-gd-scripts" | ||
NOK_DATA_DIR = "../invalid-gd-scripts" | ||
BUGS_DATA_DIR = "../potential-godot-bugs" | ||
|
||
|
||
def pytest_generate_tests(metafunc): | ||
this_directory = os.path.dirname(os.path.abspath(__file__)) | ||
if "gdscript_ok_path" in metafunc.fixturenames: | ||
directory_tests = os.path.join(this_directory, OK_DATA_DIR) | ||
metafunc.parametrize( | ||
"gdscript_ok_path", | ||
[os.path.join(directory_tests, f) for f in os.listdir(directory_tests)], | ||
) | ||
if "gdscript_nok_path" in metafunc.fixturenames: | ||
directory_tests = os.path.join(this_directory, NOK_DATA_DIR) | ||
metafunc.parametrize( | ||
"gdscript_nok_path", | ||
[os.path.join(directory_tests, f) for f in os.listdir(directory_tests)], | ||
) | ||
if "gdscript_bug_path" in metafunc.fixturenames: | ||
directory_tests = os.path.join(this_directory, BUGS_DATA_DIR) | ||
metafunc.parametrize( | ||
"gdscript_bug_path", | ||
[os.path.join(directory_tests, f) for f in os.listdir(directory_tests)], | ||
) | ||
|
||
|
||
@pytest.mark.skipif(shutil.which(GODOT_SERVER) is None, reason="requires godot server") | ||
@pytest.mark.godot_check_only | ||
def test_godot_check_only_success(gdscript_ok_path, tmp_path): | ||
write_project_settings(tmp_path) | ||
write_file(tmp_path, "dummy.gd", "class X:\n\tpass") | ||
with subprocess.Popen( | ||
[ | ||
GODOT_SERVER, | ||
"--headless", | ||
"--check-only", | ||
"-s", | ||
gdscript_ok_path, | ||
"--path", | ||
tmp_path, | ||
], | ||
) as process: | ||
process.wait() | ||
assert process.returncode == 0 | ||
|
||
|
||
@pytest.mark.skipif(shutil.which(GODOT_SERVER) is None, reason="requires godot server") | ||
@pytest.mark.godot_check_only | ||
def test_godot_check_only_failure(gdscript_nok_path): | ||
with subprocess.Popen( | ||
[GODOT_SERVER, "--headless", "--check-only", "-s", gdscript_nok_path], | ||
) as process: | ||
process.wait() | ||
assert process.returncode != 0 | ||
|
||
|
||
@pytest.mark.skipif(shutil.which(GODOT_SERVER) is None, reason="requires godot server") | ||
@pytest.mark.godot_check_only | ||
def test_godot_check_only_potential_bugs(gdscript_bug_path): | ||
with subprocess.Popen( | ||
[GODOT_SERVER, "--headless", "--check-only", "-s", gdscript_bug_path], | ||
) as process: | ||
process.wait() | ||
assert process.returncode != 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
func foo(): | ||
# pass | ||
var f0 = func bar(): | ||
pass | ||
var f1 = func(): | ||
pass | ||
var f11 = func(): | ||
var f11r = func(): | ||
pass | ||
var f12 = func(): | ||
var f12r = func(): | ||
return func(): pass | ||
var f13 = func(): | ||
pass | ||
var f13r = func(): | ||
pass | ||
return func(): pass | ||
var f14 = func(): | ||
pass | ||
var f14r = func(): | ||
if true: | ||
pass | ||
# var f2s = [func(): | ||
# pass] | ||
# var f3s = [func(): | ||
# pass, func(): | ||
# pass] | ||
# var f4s = [func(): | ||
# return [1,2,3], func(): | ||
# pass] | ||
# Godot 4.3 failing: | ||
# var fx = func(): | ||
# pass if true else func(): | ||
# pass | ||
# var fx = func(): | ||
# pass is int |