summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/parser/features/match_array.gd
blob: 9103092cb41d82a15c211c0e382344b7be12e690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
func foo(x):
	match x:
		["value1"]:
			print('["value1"]')
		["value1", "value2"]:
			print('["value1", "value2"]')

func bar(x):
	match x:
		[
			"value1"
		]:
			print('multiline ["value1"]')
		[
			"value1",
			"value2",
		]:
			print('multiline ["value1", "value2",]')
		[
			"value1",
			[
				"value2",
				..,
			],
		]:
			print('multiline ["value1", ["value2", ..,],]')

func test():
	foo(["value1"])
	foo(["value1", "value2"])
	bar(["value1"])
	bar(["value1", "value2"])
	bar(["value1", ["value2", "value3"]])