1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Add dozens of new integration tests to the GDScript test suite

This also ignores `.out` files in the file format static checks.
This commit is contained in:
Hugo Locurcio
2021-04-19 20:50:52 +02:00
parent a9b600bac0
commit c0083c0f90
190 changed files with 1788 additions and 17 deletions

View File

@@ -0,0 +1,3 @@
func test():
# Arrays with consecutive commas are not allowed.
var array = ["arrays",,,,]

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected expression as array element.

View File

@@ -0,0 +1,2 @@
func test():
var hello == "world"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected end of statement after variable declaration, found "==" instead.

View File

@@ -0,0 +1,2 @@
func test():
var hello === "world"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected end of statement after variable declaration, found "==" instead.

View File

@@ -0,0 +1,4 @@
func test():
# Error here.
if foo = 25:
print(foo)

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Assignment is not allowed inside an expression.

View File

@@ -0,0 +1,2 @@
func test():
var hello = "world" = "test"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Assignment is not allowed inside an expression.

View File

@@ -0,0 +1,4 @@
func test():
# Error here.
if var foo = 25:
print(foo)

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected conditional expression after "if".

View File

@@ -0,0 +1,2 @@
func test():
var = "world"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected variable name after "var".

View File

@@ -0,0 +1,6 @@
# Error here. `class_name` should be used *before* annotations, not after.
@icon("res://path/to/optional/icon.svg")
class_name HelloWorld
func test():
pass

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
"class_name" should be used before annotations.

View File

@@ -0,0 +1,3 @@
func test():
var TEST = 50
const TEST = 25

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
There is already a variable named "TEST" declared in this scope.

View File

@@ -0,0 +1,7 @@
func hello(arg1):
print(arg1)
func test():
# Error here.
hello(arg1 = 25)

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Assignment is not allowed inside an expression.

View File

@@ -0,0 +1,5 @@
const test = 25
func test():
pass

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Function "test" has the same name as a previously declared constant.

View File

@@ -0,0 +1,7 @@
func test():
pass
# Error here. The difference with `variable-conflicts-function.gd` is that here,
# the function is defined *before* the variable.
var test = 25

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Variable "test" has the same name as a previously declared function.

View File

@@ -0,0 +1,3 @@
func test():
# Error here.
var 23test = "is not a valid identifier"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected variable name after "var".

View File

@@ -0,0 +1,3 @@
func test():
# Error here.
var "yes" = "is not a valid identifier"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected variable name after "var".

View File

@@ -1,6 +0,0 @@
func args(a, b):
print(a)
print(b)
func test():
args(1,)

View File

@@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
Too few arguments for "args()" call. Expected at least 2 but received 1.

View File

@@ -1,2 +1,2 @@
func test():
var a = ("missing paren ->"
var a = ("missing paren ->"

View File

@@ -1,3 +1,3 @@
func test():
if true # Missing colon here.
print("true")
if true # Missing colon here.
print("true")

View File

@@ -1,6 +1,6 @@
func args(a, b):
print(a)
print(b)
print(a)
print(b)
func test():
args(1,2
args(1,2

View File

@@ -0,0 +1,3 @@
func test():
# Number separators may not be placed right next to each other.
var __ = 1__23

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Only one underscore can be used as a numeric separator.

View File

@@ -1,3 +1,5 @@
extends Node
func test():
var a = $ # Expected some node path.
var a = $ # Expected some node path.

View File

@@ -0,0 +1,2 @@
func test():
var while = "it's been a while"

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected variable name after "var".

View File

@@ -0,0 +1,5 @@
func test():
const TEST = 25
# Error here (can't redeclare a constant on the same scope).
const TEST = 50

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
There is already a constant named "TEST" declared in this scope.

View File

@@ -0,0 +1,3 @@
func test():
const TEST = 25
var TEST = 50

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
There is already a constant named "TEST" declared in this scope.

View File

@@ -0,0 +1,6 @@
var test = 25
# Error here. The difference with `variable-conflicts-function.gd` is that here,
# the function is defined *before* the variable.
func test():
pass

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Function "test" has the same name as a previously declared variable.

View File

@@ -1,3 +1,5 @@
extends Node
func test():
$23 # Can't use number here.
$23 # Can't use number here.

View File

@@ -1,3 +1,5 @@
extends Node
func test():
$MyNode/23 # Can't use number here.
$MyNode/23 # Can't use number here.

View File

@@ -0,0 +1,16 @@
func test():
# Indexing from the beginning:
print([1, 2, 3][0])
print([1, 2, 3][1])
print([1, 2, 3][2])
# Indexing from the end:
print([1, 2, 3][-1])
print([1, 2, 3][-2])
print([1, 2, 3][-3])
# Float indices are currently allowed, but should probably be an error?
print([1, 2, 3][0.4])
print([1, 2, 3][0.8])
print([1, 2, 3][1.0])
print([1, 2, 3][-1.0])

View File

@@ -0,0 +1,11 @@
GDTEST_OK
1
2
3
3
2
1
1
1
2
3

View File

@@ -0,0 +1,50 @@
enum Flags {
FIRE = 1 << 1,
ICE = 1 << 2,
SLIPPERY = 1 << 3,
STICKY = 1 << 4,
NONSOLID = 1 << 5,
ALL = FIRE | ICE | SLIPPERY | STICKY | NONSOLID,
}
func test():
var flags = Flags.FIRE | Flags.SLIPPERY
print(flags)
flags = Flags.FIRE & Flags.SLIPPERY
print(flags)
flags = Flags.FIRE ^ Flags.SLIPPERY
print(flags)
flags = Flags.ALL & (Flags.FIRE | Flags.ICE)
print(flags)
flags = (Flags.ALL & Flags.FIRE) | Flags.ICE
print(flags)
flags = Flags.ALL & Flags.FIRE | Flags.ICE
print(flags)
# Enum value must be casted to an integer. Otherwise, a parser error is emitted.
flags &= int(Flags.ICE)
print(flags)
flags ^= int(Flags.ICE)
print(flags)
flags |= int(Flags.STICKY | Flags.SLIPPERY)
print(flags)
print()
var num = 2 << 4
print(num)
num <<= 2
print(num)
num >>= 2
print(num)

View File

@@ -0,0 +1,14 @@
GDTEST_OK
10
0
10
6
6
6
4
0
24
32
128
32

View File

@@ -0,0 +1,25 @@
# Test non-nested/slightly nested class architecture.
class Test:
var number = 25
var string = "hello"
class TestSub extends Test:
var other_string = "bye"
class TestConstructor:
func _init(argument = 10):
print(str("constructor with argument ", argument))
func test():
var test_instance = Test.new()
test_instance.number = 42
var test_sub = TestSub.new()
assert(test_sub.number == 25) # From Test.
assert(test_sub.other_string == "bye") # From TestSub.
TestConstructor.new()
TestConstructor.new(500)

View File

@@ -0,0 +1,3 @@
GDTEST_OK
constructor with argument 10
constructor with argument 500

View File

@@ -0,0 +1,33 @@
# Test deeply nested class architectures.
class Test:
var depth = 1
class Nested:
var depth_nested = 10
class Test2 extends Test:
var depth2 = 2
class Test3 extends Test2:
var depth3 = 3
class Test4 extends Test3:
var depth4 = 4
class Nested2:
var depth4_nested = 100
func test():
print(Test.new().depth)
print(Test2.new().depth)
print(Test2.new().depth2)
print(Test3.new().depth)
print(Test3.new().depth3)
print(Test4.new().depth)
print(Test4.new().depth4)
print(Test.Nested.new().depth_nested)
print(Test4.Nested2.new().depth4_nested)

View File

@@ -0,0 +1,10 @@
GDTEST_OK
1
1
2
1
3
1
4
10
100

View File

@@ -0,0 +1,5 @@
class_name HelloWorld
@icon("res://path/to/optional/icon.svg")
func test():
pass

View File

@@ -0,0 +1 @@
GDTEST_OK

View File

@@ -0,0 +1,4 @@
func test():
print(20 + 20)
print("hello" + "world")
print([1, 2] + [3, 4])

View File

@@ -0,0 +1,4 @@
GDTEST_OK
40
helloworld
[1, 2, 3, 4]

View File

@@ -0,0 +1,11 @@
func test():
const _TEST = 12 + 34 - 56 * 78
const _STRING = "yes"
const _VECTOR = Vector2(5, 6)
const _ARRAY = []
const _DICTIONARY = {"this": "dictionary"}
# Create user constants from built-in constants.
const _HELLO = PI + TAU
const _INFINITY = INF
const _NOT_A_NUMBER = NAN

View File

@@ -0,0 +1,33 @@
GDTEST_OK
>> WARNING
>> Line: 2
>> UNUSED_LOCAL_CONSTANT
>> The local constant '_TEST' is declared but never used in the block. If this is intended, prefix it with an underscore: '__TEST'
>> WARNING
>> Line: 3
>> UNUSED_LOCAL_CONSTANT
>> The local constant '_STRING' is declared but never used in the block. If this is intended, prefix it with an underscore: '__STRING'
>> WARNING
>> Line: 4
>> UNUSED_LOCAL_CONSTANT
>> The local constant '_VECTOR' is declared but never used in the block. If this is intended, prefix it with an underscore: '__VECTOR'
>> WARNING
>> Line: 5
>> UNUSED_LOCAL_CONSTANT
>> The local constant '_ARRAY' is declared but never used in the block. If this is intended, prefix it with an underscore: '__ARRAY'
>> WARNING
>> Line: 6
>> UNUSED_LOCAL_CONSTANT
>> The local constant '_DICTIONARY' is declared but never used in the block. If this is intended, prefix it with an underscore: '__DICTIONARY'
>> WARNING
>> Line: 9
>> UNUSED_LOCAL_CONSTANT
>> The local constant '_HELLO' is declared but never used in the block. If this is intended, prefix it with an underscore: '__HELLO'
>> WARNING
>> Line: 10
>> UNUSED_LOCAL_CONSTANT
>> The local constant '_INFINITY' is declared but never used in the block. If this is intended, prefix it with an underscore: '__INFINITY'
>> WARNING
>> Line: 11
>> UNUSED_LOCAL_CONSTANT
>> The local constant '_NOT_A_NUMBER' is declared but never used in the block. If this is intended, prefix it with an underscore: '__NOT_A_NUMBER'

View File

@@ -0,0 +1,37 @@
func test():
# Non-string keys are valid.
print({ 12: "world" }[12])
var contents = {
0: "zero",
0.0: "zero point zero",
null: "null",
false: "false",
[]: "empty array",
Vector2i(): "zero Vector2i",
15: {
22: {
4: ["nesting", "arrays"],
},
},
}
print(contents[0.0])
# Making sure declaration order doesn't affect things...
print({ 0.0: "zero point zero", 0: "zero", null: "null", false: "false", []: "empty array" }[0])
print({ 0.0: "zero point zero", 0: "zero", null: "null", false: "false", []: "empty array" }[0.0])
print(contents[null])
print(contents[false])
print(contents[[]])
print(contents[Vector2i()])
print(contents[15])
print(contents[15][22])
print(contents[15][22][4])
print(contents[15][22][4][0])
print(contents[15][22][4][1])
# Currently fails with "invalid get index 'hello' on base Dictionary".
# Both syntaxes are valid however.
#print({ "hello": "world" }["hello"])
#print({ "hello": "world" }.hello)

View File

@@ -0,0 +1,14 @@
GDTEST_OK
world
zero point zero
zero
zero point zero
null
false
empty array
zero Vector2i
{22:{4:[nesting, arrays]}}
{4:[nesting, arrays]}
[nesting, arrays]
nesting
arrays

View File

@@ -0,0 +1,12 @@
func test():
# Mixing Python-style and Lua-style syntax in the same dictionary declaration
# is allowed.
var dict = {
"hello": {
world = {
"is": "beautiful",
},
},
}
print(dict)

View File

@@ -0,0 +1,2 @@
GDTEST_OK
{hello:{world:{is:beautiful}}}

View File

@@ -0,0 +1,20 @@
extends Node
func test():
# Create the required node structure.
var hello = Node.new()
hello.name = "Hello"
add_child(hello)
var world = Node.new()
world.name = "World"
hello.add_child(world)
# All the ways of writing node paths below with the `$` operator are valid.
# Results are assigned to variables to avoid warnings.
var __ = $Hello
__ = $"Hello"
__ = $Hello/World
__ = $"Hello/World"
__ = $"Hello/.."
__ = $"Hello/../Hello/World"

View File

@@ -0,0 +1 @@
GDTEST_OK

View File

@@ -0,0 +1,14 @@
enum Size {
S = -10,
M,
L = 0,
XL = 10,
XXL,
}
func test():
print(Size.S)
print(Size.M)
print(Size.L)
print(Size.XL)
print(Size.XXL)

View File

@@ -0,0 +1,6 @@
GDTEST_OK
-10
-9
0
10
11

View File

@@ -0,0 +1,11 @@
@export var example = 99
@export_range(0, 100) var example_range = 100
@export_range(0, 100, 1) var example_range_step = 101
@export_range(0, 100, 1, "or_greater") var example_range_step_or_greater = 102
func test():
print(example)
print(example_range)
print(example_range_step)
print(example_range_step_or_greater)

View File

@@ -0,0 +1,5 @@
GDTEST_OK
99
100
101
102

View File

@@ -0,0 +1,24 @@
func test():
# The following floating-point notations are all valid:
print(is_equal_approx(123., 123))
print(is_equal_approx(.123, 0.123))
print(is_equal_approx(.123e4, 1230))
print(is_equal_approx(123.e4, 1.23e6))
print(is_equal_approx(.123e-1, 0.0123))
print(is_equal_approx(123.e-1, 12.3))
# Same as above, but with negative numbers.
print(is_equal_approx(-123., -123))
print(is_equal_approx(-.123, -0.123))
print(is_equal_approx(-.123e4, -1230))
print(is_equal_approx(-123.e4, -1.23e6))
print(is_equal_approx(-.123e-1, -0.0123))
print(is_equal_approx(-123.e-1, -12.3))
# Same as above, but with explicit positive numbers (which is redundant).
print(is_equal_approx(+123., +123))
print(is_equal_approx(+.123, +0.123))
print(is_equal_approx(+.123e4, +1230))
print(is_equal_approx(+123.e4, +1.23e6))
print(is_equal_approx(+.123e-1, +0.0123))
print(is_equal_approx(+123.e-1, +12.3))

View File

@@ -0,0 +1,19 @@
GDTEST_OK
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true

View File

@@ -0,0 +1,39 @@
func test():
for i in range(5):
print(i)
print()
# Equivalent to the above `for` loop:
for i in 5:
print(i)
print()
for i in range(1, 5):
print(i)
print()
for i in range(1, -5, -1):
print(i)
print()
for i in [2, 4, 6, -8]:
print(i)
print()
for i in [true, false]:
print(i)
print()
for i in [Vector2i(10, 20), Vector2i(-30, -40)]:
print(i)
print()
for i in "Hello_Unicôde_world!_🦄":
print(i)

View File

@@ -0,0 +1,58 @@
GDTEST_OK
0
1
2
3
4
0
1
2
3
4
1
2
3
4
1
0
-1
-2
-3
-4
2
4
6
-8
true
false
(10, 20)
(-30, -40)
H
e
l
l
o
_
U
n
i
c
ô
d
e
_
w
o
r
l
d
!
_
🦄

View File

@@ -0,0 +1,14 @@
func test():
print("dot" in "Godot")
print(not "i" in "team")
print(true in [true, false])
print(not null in [true, false])
print(null in [null])
print(26 in [8, 26, 64, 100])
print(not Vector2i(10, 20) in [Vector2i(20, 10)])
print("apple" in { "apple": "fruit" })
print("apple" in { "apple": null })
print(not "apple" in { "fruit": "apple" })

View File

@@ -0,0 +1,11 @@
GDTEST_OK
true
true
true
true
true
true
true
true
true
true

View File

@@ -0,0 +1,18 @@
func test():
var i = "Hello"
match i:
"Hello":
print("hello")
# This will fall through to the default case below.
continue
"Good bye":
print("bye")
_:
print("default")
var j = 25
match j:
26:
print("This won't match")
_:
print("This will match")

View File

@@ -0,0 +1,4 @@
GDTEST_OK
hello
default
This will match

View File

@@ -0,0 +1,7 @@
func test():
var __ = [
"this",
"is", "a","multiline",
"array", "with mixed indentation and trailing comma",
]

View File

@@ -0,0 +1 @@
GDTEST_OK

View File

@@ -0,0 +1,10 @@
func test():
var __ = {
"multiline": "dictionary","should": "work",
"even with": "a trailing comma",
}
__ = {
this_also_applies = "to the",
lua_style_syntax = null, foo = null,
}

View File

@@ -0,0 +1 @@
GDTEST_OK

View File

@@ -0,0 +1,14 @@
func test():
# Line breaks are allowed within parentheses.
if (
1 == 1
and 2 == 2 and
3 == 3
):
pass
# Alternatively, backslashes can be used.
if 1 == 1 \
and 2 == 2 and \
3 == 3:
pass

View File

@@ -0,0 +1 @@
GDTEST_OK

View File

@@ -0,0 +1,15 @@
func test():
var __ = """
This is a standalone string, not a multiline comment.
Writing both "double" quotes and 'simple' quotes is fine as
long as there is only ""one"" or ''two'' of those in a row, not more.
If you have more quotes, they need to be escaped like this: \"\"\"
"""
__ = '''
Another standalone string, this time with single quotes.
Writing both "double" quotes and 'simple' quotes is fine as
long as there is only ""one"" or ''two'' of those in a row, not more.
If you have more quotes, they need to be escaped like this: \'\'\'
'''

View File

@@ -0,0 +1 @@
GDTEST_OK

View File

@@ -0,0 +1,17 @@
func test():
Vector2(
1,
2
)
Vector3(
3,
3.5,
4, # Trailing comma should work.
)
Vector2i(1, 2,) # Trailing comma should work.
Vector3i(6,
9,
12)

View File

@@ -0,0 +1 @@
GDTEST_OK

View File

@@ -0,0 +1,22 @@
func test():
print(+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++2.718)
print()
print(------------------------------------------------------------------2.718)
print(-------------------------------------------------------------------2.718)
print()
print(~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~999)
print()
print(+-+-+-----+------------+++++++---++--++--+--+---+--++2.718)
print()
print(2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 0.444)
print(153023902390239 % 550 % 29 % 27 % 23 % 17)
print(2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2 >> 2)
print(8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8 ^ -8 ^ 8 ^ 8 ^ 8 ^ 8 ^ 8)

View File

@@ -0,0 +1,82 @@
GDTEST_OK
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
>> WARNING
>> Line: 19
>> INTEGER_DIVISION
>> Integer division, decimal part will be discarded.
2.718
2.718
-2.718
-1000
-2.718
36900.9009009009
2
8192
-8

View File

@@ -0,0 +1,5 @@
func test():
var array = [[[[[[[[[[15]]]]]]]]]]
print(array[0][0][0][0][0][0][0][0])
print(array[0][0][0][0][0][0][0][0][0])
print(array[0][0][0][0][0][0][0][0][0][0])

View File

@@ -0,0 +1,4 @@
GDTEST_OK
[[15]]
[15]
15

View File

@@ -0,0 +1,6 @@
func test():
var dictionary = {1: {2: {3: {4: {5: {6: {7: {8: {"key": "value"}}}}}}}}}
print(dictionary[1][2][3][4][5][6][7])
print(dictionary[1][2][3][4][5][6][7][8])
print(dictionary[1][2][3][4][5][6][7][8].key)
print(dictionary[1][2][3][4][5][6][7][8]["key"])

View File

@@ -0,0 +1,5 @@
GDTEST_OK
{8:{key:value}}
{key:value}
value
value

View File

@@ -0,0 +1,57 @@
func test():
# 20 levels of nesting (and then some).
if true:
print("1")
if true:
print("2")
if true:
print("3")
if true:
print("4")
if true:
print("5")
if true:
print("6")
if true:
print("7")
if true:
print("8")
if true:
print("9")
if true:
print("10")
if true:
print("11")
if true:
print("12")
if true:
print("13")
if true:
print("14")
if true:
print("15")
if true:
print("16")
if true:
print("17")
if true:
print("18")
if true:
print("19")
if true:
print("20")
if false:
print("End")
if true:
if true:
if true:
if true:
if true:
if true:
if true:
if true:
if true:
if true:
if true:
if true:
print("This won't be printed")

View File

@@ -0,0 +1,21 @@
GDTEST_OK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

View File

@@ -0,0 +1,79 @@
func test():
# 20 levels of nesting (and then some).
var number = 1234
match number:
1234:
print("1")
match number:
1234:
print("2")
match number:
1234:
print("3")
continue
_:
print("Should also be printed")
match number:
1234:
print("4")
match number:
_:
print("5")
match number:
false:
print("Should not be printed")
true:
print("Should not be printed")
"hello":
print("Should not be printed")
1234:
print("6")
match number:
_:
print("7")
match number:
1234:
print("8")
match number:
_:
print("9")
match number:
1234:
print("10")
match number:
_:
print("11")
match number:
1234:
print("12")
match number:
_:
print("13")
match number:
1234:
print("14")
match number:
_:
print("15")
match number:
_:
print("16")
match number:
1234:
print("17")
match number:
_:
print("18")
match number:
1234:
print("19")
match number:
_:
print("20")
match number:
[]:
print("Should not be printed")
_:
print("Should not be printed")
5678:
print("Should not be printed either")

View File

@@ -0,0 +1,22 @@
GDTEST_OK
1
2
3
Should also be printed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

View File

@@ -0,0 +1,65 @@
func test():
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((print("Hello world!"))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
print(((((((((((((((((((((((((((((((((((((((((((((((((((((((((("Hello world 2!"))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
print(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(2)) + ((4))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

View File

@@ -0,0 +1,4 @@
GDTEST_OK
Hello world!
Hello world 2!
6

Some files were not shown because too many files have changed in this diff Show More