Skip to content

Commit 2f5d05d

Browse files
committed
feat: add test for construct using unit struct
1 parent 7a251c0 commit 2f5d05d

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
local type = world.get_type_by_name("UnitStruct")
2+
local constructed = construct(type, {})
3+
4+
assert(constructed ~= nil, "Value was not constructed")

crates/testing_crates/test_utils/src/test_data.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ impl TestResourceWithVariousFields {
139139
}
140140
}
141141

142+
#[derive(Component, Reflect, PartialEq, Eq, Debug, Default)]
143+
#[reflect(Component, Default)]
144+
pub struct UnitStruct;
145+
146+
impl UnitStruct {
147+
pub fn init() -> Self {
148+
Self
149+
}
150+
}
151+
142152
#[derive(Component, Reflect, PartialEq, Eq, Debug, Default)]
143153
#[reflect(Component, Default)]
144154
pub struct SimpleStruct {
@@ -256,14 +266,15 @@ impl_test_component_ids!(
256266
CompWithDefault => 2,
257267
CompWithDefaultAndComponentData => 3,
258268
CompWithFromWorldAndComponentData => 4,
259-
SimpleStruct => 5,
260-
SimpleTupleStruct => 6,
261-
SimpleEnum => 7,
269+
UnitStruct => 5,
270+
SimpleStruct => 6,
271+
SimpleTupleStruct => 7,
272+
SimpleEnum => 8,
262273
],
263274
[
264-
TestResource => 8,
265-
ResourceWithDefault => 9,
266-
TestResourceWithVariousFields => 10,
275+
TestResource => 9,
276+
ResourceWithDefault => 10,
277+
TestResourceWithVariousFields => 11,
267278
]
268279
);
269280

0 commit comments

Comments
 (0)