Fix dart object api test (#8751)

This commit is contained in:
Jakob Kordež
2025-11-26 23:36:08 +01:00
committed by GitHub
parent 7808ae5c88
commit 8e901ce17c

View File

@@ -868,15 +868,14 @@ class ObjectAPITest {
..name = 'Monstrous' ..name = 'Monstrous'
..inventory = [24, 42] ..inventory = [24, 42]
..color = example.Color.Green ..color = example.Color.Green
// TODO be smarter for unions and automatically set the `type` field?
..testType = example.AnyTypeId.MyGame_Example2_Monster ..testType = example.AnyTypeId.MyGame_Example2_Monster
..test = example2.MonsterT() ..test = example2.MonsterT()
..test4 = [example.TestT(a: 3, b: 4), example.TestT(a: 5, b: 6)] ..test4 = [example.TestT(a: 3, b: 4), example.TestT(a: 5, b: 6)]
..testarrayofstring = ["foo", "bar"] ..testarrayofstring = ["foo", "bar"]
..testarrayoftables = [example.MonsterT(name: 'Oof')] ..testarrayoftables = [example.MonsterT(name: 'Oof', testf: 2.75)]
..enemy = example.MonsterT(name: 'Enemy') ..enemy = example.MonsterT(name: 'Enemy', testf: 2.5)
..testarrayofbools = [false, true, false] ..testarrayofbools = [false, true, false]
..testf = 42.24 ..testf = 42.25
..testarrayofsortedstruct = [ ..testarrayofsortedstruct = [
example.AbilityT(id: 1, distance: 5), example.AbilityT(id: 1, distance: 5),
example.AbilityT(id: 3, distance: 7), example.AbilityT(id: 3, distance: 7),
@@ -894,16 +893,15 @@ class ObjectAPITest {
fbBuilder.finish(offset); fbBuilder.finish(offset);
final data = fbBuilder.buffer; final data = fbBuilder.buffer;
// TODO currently broken because of struct builder issue, see #6688 final monster2 = example.Monster(data); // Monster (reader)
// final monster2 = example.Monster(data); // Monster (reader) expect(
// expect( // map Monster => MonsterT, Vec3 => Vec3T, ...
// // map Monster => MonsterT, Vec3 => Vec3T, ... monster2.toString().replaceAllMapped(
// monster2.toString().replaceAllMapped( RegExp('([a-zA-z0-9]+){'), (match) => match.group(1)! + 'T{'),
// RegExp('([a-zA-z0-9]+){'), (match) => match.group(1) + 'T{'), monster.toString());
// monster.toString());
// final monster3 = monster2.unpack(); // MonsterT
// final monster3 = monster2.unpack(); // MonsterT expect(monster3.toString(), monster.toString());
// expect(monster3.toString(), monster.toString());
} }
void test_Lists() { void test_Lists() {