You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: assets/tests/construct/construct_enum.lua
+12-6Lines changed: 12 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -6,22 +6,28 @@ local constructed = construct(type, {
6
6
foo=123
7
7
})
8
8
9
-
assert(constructed:variant_name() =="Struct", "Value was constructed incorrectly, expected constructed.variant to be Struct but got " ..constructed:variant_name())
10
-
assert(constructed.foo==123, "Value was constructed incorrectly, expected constructed.foo to be 123 but got " ..constructed.foo)
9
+
assert(constructed:variant_name() =="Struct",
10
+
"Value was constructed incorrectly, expected constructed.variant to be Struct but got " ..constructed:variant_name())
11
+
assert(constructed.foo==123,
12
+
"Value was constructed incorrectly, expected constructed.foo to be 123 but got " ..constructed.foo)
11
13
12
14
13
15
-- TupleStruct Variant
14
16
localconstructed=construct(type, {
15
17
variant="TupleStruct",
16
-
_1=123
18
+
["1"]=123
17
19
})
18
20
19
-
assert(constructed:variant_name() =="TupleStruct", "Value was constructed incorrectly, expected constructed.variant to be TupleStruct but got " ..constructed:variant_name())
20
-
assert(constructed._1==123, "Value was constructed incorrectly, expected constructed._1 to be 123 but got " ..constructed._1)
"Value was constructed incorrectly, expected constructed.variant to be TupleStruct but got " ..
23
+
constructed:variant_name())
24
+
assert(constructed[1] ==123,
25
+
"Value was constructed incorrectly, expected constructed._1 to be 123 but got " ..constructed[1])
21
26
22
27
-- Unit Variant
23
28
localconstructed=construct(type, {
24
29
variant="Unit"
25
30
})
26
31
27
-
assert(constructed:variant_name() =="Unit", "Value was constructed incorrectly, expected constructed.variant to be Unit but got " ..constructed:variant_name())
32
+
assert(constructed:variant_name() =="Unit",
33
+
"Value was constructed incorrectly, expected constructed.variant to be Unit but got " ..constructed:variant_name())
assert(constructed.variant_name.call() == "TupleStruct", "Value was constructed incorrectly, expected constructed.variant to be TupleStruct but got " + constructed.variant_name.call());
13
-
assert(constructed["_0"] == 123, "Value was constructed incorrectly, expected constructed._0 to be 123 but got " + constructed["_0"]);
13
+
assert(constructed[0] == 123, "Value was constructed incorrectly, expected constructed[0] to be 123 but got " + constructed[0]);
0 commit comments