summaryrefslogtreecommitdiff
path: root/tests/monster_test.fbs
diff options
context:
space:
mode:
authorJames Kuszmaul <jkuszmaul@users.noreply.github.com>2022-03-04 21:57:48 -0800
committerGitHub <noreply@github.com>2022-03-04 21:57:48 -0800
commit9ed13230448ad337e127c376028c8d55bacb2008 (patch)
tree3c30ab07cb4331c7f88aaa53e185dbd21603bfc9 /tests/monster_test.fbs
parent1a4c405662a4a7a448ea5a21a6ae6ea43d4f096c (diff)
downloadflatbuffers-9ed13230448ad337e127c376028c8d55bacb2008.tar.gz
flatbuffers-9ed13230448ad337e127c376028c8d55bacb2008.tar.bz2
flatbuffers-9ed13230448ad337e127c376028c8d55bacb2008.zip
Fix 64-bit numeric enum values in typescript (#7135)
* Fix 64-bit default numeric enum values in typescript If you had a default value that wasn't a valid enum value (e.g., a zero if you used a bit_flag setting, like you get with AdvancedFeatures in reflection.fbs), we weren't using BigInt. * Run generate_code.py * [DART] Handle deprecated fields & invalid enum defaults * Update .NET test
Diffstat (limited to 'tests/monster_test.fbs')
-rw-r--r--tests/monster_test.fbs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/monster_test.fbs b/tests/monster_test.fbs
index f177bc17..b28ddc85 100644
--- a/tests/monster_test.fbs
+++ b/tests/monster_test.fbs
@@ -31,6 +31,14 @@ enum Race:byte {
Elf,
}
+enum LongEnum:ulong (bit_flags) {
+ LongOne = 1,
+ LongTwo = 2,
+ // Because this is a bitflag, 40 will be out of range of a 32-bit integer,
+ // allowing us to exercise any logic special to big numbers.
+ LongBig = 40,
+}
+
union Any { Monster, TestSimpleTableWithEnum, MyGame.Example2.Monster }
union AnyUniqueAliases { M: Monster, TS: TestSimpleTableWithEnum, M2: MyGame.Example2.Monster }
@@ -125,6 +133,10 @@ table Monster {
testrequirednestedflatbuffer:[ubyte] (id:49, nested_flatbuffer: "Monster");
scalar_key_sorted_tables:[Stat] (id: 50);
native_inline:Test (id: 51, native_inline);
+ // The default value of this enum will be a numeric zero, which isn't a valid
+ // enum value.
+ long_enum_non_enum_default:LongEnum (id: 52);
+ long_enum_normal_default:LongEnum = LongOne (id: 53);
}
table TypeAliases {