Skip to content

Commit 38c0d6a

Browse files
committed
Update tests
1 parent 28a8ef6 commit 38c0d6a

23 files changed

Lines changed: 355 additions & 10 deletions

test/godot_project/gdscript/out/EReg.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func matchedRight() -> String:
3434

3535
return ""
3636

37-
func matchedPos() -> Dictionary:
37+
func matchedPos() -> Variant:
3838
if (self.m == null):
3939
return {
4040
"pos": -1,
@@ -69,7 +69,7 @@ func split(s: String) -> Array[String]:
6969

7070
while (true):
7171
if (self.matchSub(s, index, -1)):
72-
var pos: Dictionary = self.matchedPos()
72+
var pos: Variant = self.matchedPos()
7373
var tempString
7474
if true:
7575
var endIndex: int = pos.get("pos")

test/godot_project/gdscript/out/Log.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static var trace = func(v, infos = null) -> void:
88
func _init() -> void:
99
pass
1010

11-
static func formatOutput(v, infos: Dictionary) -> String:
11+
static func formatOutput(v, infos: Variant) -> String:
1212
var _str: String = str(v)
1313

1414
if (infos == null):

test/godot_project/gdscript/out/Reflect.gd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ static func callMethod(o, _func, args: Array[Variant]):
3535
return _func.callv(args)
3636

3737
static func fields(o) -> Array[String]:
38-
var list: Array[Dictionary] = o.get_property_list.call()
38+
var list: Array[Variant] = o.get_property_list()
3939
var result: Array[String] = ([] as Array[String])
4040
var _g: int = 0
4141

4242
while (_g < list.size()):
43-
var l: Dictionary = list[_g]
43+
var l: Variant = list[_g]
4444
_g += 1
4545
result.push_back(l.get("name"))
4646

@@ -100,4 +100,3 @@ static func makeVarArgs(f):
100100
_g.push_back(v)
101101
tempArray = _g
102102
return f.call(tempArray)
103-

test/godot_project/gdscript/out/TestAll.gd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ static func test() -> void:
1717
TestReflect.test()
1818
TestClass.test()
1919
TestSignals.test()
20+
TestMap.test()
2021
Log.trace.call("Tests successful!!", {
2122
"fileName": "src/test/TestAll.hx",
22-
"lineNumber": 19,
23+
"lineNumber": 20,
2324
"className": "test.TestAll",
2425
"methodName": "test"
2526
})

test/godot_project/gdscript/out/TestClass.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ static func test() -> void:
2121
"className": "test.TestClass",
2222
"methodName": "test"
2323
})
24+

test/godot_project/gdscript/out/TestEReg.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static func test() -> void:
1313
var cond: bool = reg.matched(0) == "abc"
1414
assert(cond, "Test assert failed.")
1515

16-
var pos: Dictionary = reg.matchedPos()
16+
var pos: Variant = reg.matchedPos()
1717

1818
if true:
1919
var cond: bool = pos.get("pos") == 0
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
class_name TestMap
2+
3+
func _init() -> void:
4+
pass
5+
6+
static func test() -> void:
7+
var m: StringMap = StringMap.new()
8+
var _g: IntMap = IntMap.new()
9+
10+
_g.__set(123, "123")
11+
_g.__set(321, "321")
12+
m.__set("a", 1)
13+
m.__set("b", 2)
14+
15+
var tempNumber: int = 2
16+
17+
tempNumber
18+
19+
if true:
20+
var cond: bool = m.__get("a") == 1
21+
assert(cond, "Test assert failed.")
22+
if true:
23+
var cond: bool = m.__get("b") == 2
24+
assert(cond, "Test assert failed.")
25+
if true:
26+
var cond: bool = _g.__get(321) == "321"
27+
assert(cond, "Test assert failed.")
28+
29+
var m3: StringMap = m.copy()
30+
31+
if true:
32+
var cond: bool = m3.__get("a") == 1
33+
assert(cond, "Test assert failed.")
34+
if true:
35+
var cond: bool = m3.__get("b") == 2
36+
assert(cond, "Test assert failed.")
37+
38+
m3.clear()
39+
40+
if true:
41+
var cond: bool = !m3.exists("a")
42+
assert(cond, "Test assert failed.")
43+
if true:
44+
var cond: bool = m.exists("a")
45+
assert(cond, "Test assert failed.")
46+
if true:
47+
var cond: bool = !m.exists("c")
48+
assert(cond, "Test assert failed.")
49+
if true:
50+
var cond: bool = _g.exists(123)
51+
assert(cond, "Test assert failed.")
52+
if true:
53+
var cond: bool = !_g.exists(124)
54+
assert(cond, "Test assert failed.")
55+
56+
m.remove("a")
57+
58+
if true:
59+
var cond: bool = !m.exists("a")
60+
assert(cond, "Test assert failed.")
61+
62+
Log.trace.call(m.toString(), {
63+
"fileName": "src/test/TestMap.hx",
64+
"lineNumber": 40,
65+
"className": "test.TestMap",
66+
"methodName": "test"
67+
})
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://vmtlthgbwfti

test/godot_project/gdscript/out/TestNode.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ func _ready() -> void:
1414
"className": "test.TestNode",
1515
"methodName": "_ready"
1616
})
17+

test/godot_project/gdscript/out/TestReflect.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ func _init() -> void:
44
pass
55

66
static func test() -> void:
7-
var obj: Dictionary = {
7+
var obj: Variant = {
88
"num": 123,
99
"str": "String"
1010
}

0 commit comments

Comments
 (0)