* Apply Namer to Dart.

- Also refactor idl_gen_dart a bit
  - to use more const and references
  - out parameters should be the last argument

* Add keyword test

* minor fixes

* fix merge

* extra 's'

* move dart keyord into dart dir

* Address comments

* Use $ for escaping keywords
* Outparameters for namespace_map

* Escape dollar in toString

* Escape dollar in toString2

* Use UpperCamelCase for types and variants

* try to fix ToString

* namer Type fixes

* Remove path prefixing in imports

* gen code

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2022-03-28 18:07:09 -04:00
committed by GitHub
parent ae4ce72651
commit a4cb1599d8
12 changed files with 600 additions and 332 deletions

View File

@@ -25,22 +25,27 @@ public struct KeywordsInTable : IFlatbufferObject
public bool MutatePrivate(KeywordTest.@public @private) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, (int)@private); return true; } else { return false; } }
public int Type { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
public bool MutateType(int type) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, type); return true; } else { return false; } }
public bool Default { get { int o = __p.__offset(10); return o != 0 ? 0!=__p.bb.Get(o + __p.bb_pos) : (bool)false; } }
public bool MutateDefault(bool @default) { int o = __p.__offset(10); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)(@default ? 1 : 0)); return true; } else { return false; } }
public static Offset<KeywordTest.KeywordsInTable> CreateKeywordsInTable(FlatBufferBuilder builder,
KeywordTest.ABC @is = KeywordTest.ABC.@void,
KeywordTest.@public @private = KeywordTest.@public.NONE,
int type = 0) {
builder.StartTable(3);
int type = 0,
bool @default = false) {
builder.StartTable(4);
KeywordsInTable.AddType(builder, type);
KeywordsInTable.AddPrivate(builder, @private);
KeywordsInTable.AddIs(builder, @is);
KeywordsInTable.AddDefault(builder, @default);
return KeywordsInTable.EndKeywordsInTable(builder);
}
public static void StartKeywordsInTable(FlatBufferBuilder builder) { builder.StartTable(3); }
public static void StartKeywordsInTable(FlatBufferBuilder builder) { builder.StartTable(4); }
public static void AddIs(FlatBufferBuilder builder, KeywordTest.ABC @is) { builder.AddInt(0, (int)@is, 0); }
public static void AddPrivate(FlatBufferBuilder builder, KeywordTest.@public @private) { builder.AddInt(1, (int)@private, 0); }
public static void AddType(FlatBufferBuilder builder, int type) { builder.AddInt(2, type, 0); }
public static void AddDefault(FlatBufferBuilder builder, bool @default) { builder.AddBool(3, @default, false); }
public static Offset<KeywordTest.KeywordsInTable> EndKeywordsInTable(FlatBufferBuilder builder) {
int o = builder.EndTable();
return new Offset<KeywordTest.KeywordsInTable>(o);
@@ -54,6 +59,7 @@ public struct KeywordsInTable : IFlatbufferObject
_o.Is = this.Is;
_o.Private = this.Private;
_o.Type = this.Type;
_o.Default = this.Default;
}
public static Offset<KeywordTest.KeywordsInTable> Pack(FlatBufferBuilder builder, KeywordsInTableT _o) {
if (_o == null) return default(Offset<KeywordTest.KeywordsInTable>);
@@ -61,7 +67,8 @@ public struct KeywordsInTable : IFlatbufferObject
builder,
_o.Is,
_o.Private,
_o.Type);
_o.Type,
_o.Default);
}
}
@@ -73,11 +80,14 @@ public class KeywordsInTableT
public KeywordTest.@public Private { get; set; }
[Newtonsoft.Json.JsonProperty("type")]
public int Type { get; set; }
[Newtonsoft.Json.JsonProperty("default")]
public bool Default { get; set; }
public KeywordsInTableT() {
this.Is = KeywordTest.ABC.@void;
this.Private = KeywordTest.@public.NONE;
this.Type = 0;
this.Default = false;
}
}

View File

@@ -8,6 +8,7 @@ table KeywordsInTable {
is: ABC = void;
private: public;
type: int;
default: bool = false;
}
union KeywordsInUnion {

View File

@@ -23,6 +23,7 @@ impl<'a> KeywordsInTable<'a> {
pub const VT_IS: flatbuffers::VOffsetT = 4;
pub const VT_PRIVATE: flatbuffers::VOffsetT = 6;
pub const VT_TYPE_: flatbuffers::VOffsetT = 8;
pub const VT_DEFAULT: flatbuffers::VOffsetT = 10;
pub const fn get_fully_qualified_name() -> &'static str {
"KeywordTest.KeywordsInTable"
@@ -41,6 +42,7 @@ impl<'a> KeywordsInTable<'a> {
builder.add_type_(args.type_);
builder.add_private(args.private);
builder.add_is(args.is);
builder.add_default(args.default);
builder.finish()
}
@@ -48,10 +50,12 @@ impl<'a> KeywordsInTable<'a> {
let is = self.is();
let private = self.private();
let type_ = self.type_();
let default = self.default();
KeywordsInTableT {
is,
private,
type_,
default,
}
}
@@ -67,6 +71,10 @@ impl<'a> KeywordsInTable<'a> {
pub fn type_(&self) -> i32 {
self._tab.get::<i32>(KeywordsInTable::VT_TYPE_, Some(0)).unwrap()
}
#[inline]
pub fn default(&self) -> bool {
self._tab.get::<bool>(KeywordsInTable::VT_DEFAULT, Some(false)).unwrap()
}
}
impl flatbuffers::Verifiable for KeywordsInTable<'_> {
@@ -79,6 +87,7 @@ impl flatbuffers::Verifiable for KeywordsInTable<'_> {
.visit_field::<ABC>("is", Self::VT_IS, false)?
.visit_field::<public>("private", Self::VT_PRIVATE, false)?
.visit_field::<i32>("type_", Self::VT_TYPE_, false)?
.visit_field::<bool>("default", Self::VT_DEFAULT, false)?
.finish();
Ok(())
}
@@ -87,6 +96,7 @@ pub struct KeywordsInTableArgs {
pub is: ABC,
pub private: public,
pub type_: i32,
pub default: bool,
}
impl<'a> Default for KeywordsInTableArgs {
#[inline]
@@ -95,6 +105,7 @@ impl<'a> Default for KeywordsInTableArgs {
is: ABC::void,
private: public::NONE,
type_: 0,
default: false,
}
}
}
@@ -117,6 +128,10 @@ impl<'a: 'b, 'b> KeywordsInTableBuilder<'a, 'b> {
self.fbb_.push_slot::<i32>(KeywordsInTable::VT_TYPE_, type_, 0);
}
#[inline]
pub fn add_default(&mut self, default: bool) {
self.fbb_.push_slot::<bool>(KeywordsInTable::VT_DEFAULT, default, false);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> KeywordsInTableBuilder<'a, 'b> {
let start = _fbb.start_table();
KeywordsInTableBuilder {
@@ -137,6 +152,7 @@ impl std::fmt::Debug for KeywordsInTable<'_> {
ds.field("is", &self.is());
ds.field("private", &self.private());
ds.field("type_", &self.type_());
ds.field("default", &self.default());
ds.finish()
}
}
@@ -146,6 +162,7 @@ pub struct KeywordsInTableT {
pub is: ABC,
pub private: public,
pub type_: i32,
pub default: bool,
}
impl Default for KeywordsInTableT {
fn default() -> Self {
@@ -153,6 +170,7 @@ impl Default for KeywordsInTableT {
is: ABC::void,
private: public::NONE,
type_: 0,
default: false,
}
}
}
@@ -164,10 +182,12 @@ impl KeywordsInTableT {
let is = self.is;
let private = self.private;
let type_ = self.type_;
let default = self.default;
KeywordsInTable::create(_fbb, &KeywordsInTableArgs{
is,
private,
type_,
default,
})
}
}

View File

@@ -32,7 +32,7 @@ class MonsterExtra {
@override
String toString() {
return 'MonsterExtra{d0: $d0, d1: $d1, d2: $d2, d3: $d3, f0: $f0, f1: $f1, f2: $f2, f3: $f3, dvec: $dvec, fvec: $fvec}';
return 'MonsterExtra{d0: ${d0}, d1: ${d1}, d2: ${d2}, d3: ${d3}, f0: ${f0}, f1: ${f1}, f2: ${f2}, f3: ${f3}, dvec: ${dvec}, fvec: ${fvec}}';
}
MonsterExtraT unpack() => MonsterExtraT(
@@ -99,7 +99,7 @@ class MonsterExtraT implements fb.Packable {
@override
String toString() {
return 'MonsterExtraT{d0: $d0, d1: $d1, d2: $d2, d3: $d3, f0: $f0, f1: $f1, f2: $f2, f3: $f3, dvec: $dvec, fvec: $fvec}';
return 'MonsterExtraT{d0: ${d0}, d1: ${d1}, d2: ${d2}, d3: ${d3}, f0: ${f0}, f1: ${f1}, f2: ${f2}, f3: ${f3}, dvec: ${dvec}, fvec: ${fvec}}';
}
}

View File

@@ -316,7 +316,7 @@ class Test {
@override
String toString() {
return 'Test{a: $a, b: $b}';
return 'Test{a: ${a}, b: ${b}}';
}
TestT unpack() => TestT(
@@ -347,7 +347,7 @@ class TestT implements fb.Packable {
@override
String toString() {
return 'TestT{a: $a, b: $b}';
return 'TestT{a: ${a}, b: ${b}}';
}
}
@@ -420,7 +420,7 @@ class TestSimpleTableWithEnum {
@override
String toString() {
return 'TestSimpleTableWithEnum{color: $color}';
return 'TestSimpleTableWithEnum{color: ${color}}';
}
TestSimpleTableWithEnumT unpack() => TestSimpleTableWithEnumT(
@@ -447,7 +447,7 @@ class TestSimpleTableWithEnumT implements fb.Packable {
@override
String toString() {
return 'TestSimpleTableWithEnumT{color: $color}';
return 'TestSimpleTableWithEnumT{color: ${color}}';
}
}
@@ -519,7 +519,7 @@ class Vec3 {
@override
String toString() {
return 'Vec3{x: $x, y: $y, z: $z, test1: $test1, test2: $test2, test3: $test3}';
return 'Vec3{x: ${x}, y: ${y}, z: ${z}, test1: ${test1}, test2: ${test2}, test3: ${test3}}';
}
Vec3T unpack() => Vec3T(
@@ -568,7 +568,7 @@ class Vec3T implements fb.Packable {
@override
String toString() {
return 'Vec3T{x: $x, y: $y, z: $z, test1: $test1, test2: $test2, test3: $test3}';
return 'Vec3T{x: ${x}, y: ${y}, z: ${z}, test1: ${test1}, test2: ${test2}, test3: ${test3}}';
}
}
@@ -662,7 +662,7 @@ class Ability {
@override
String toString() {
return 'Ability{id: $id, distance: $distance}';
return 'Ability{id: ${id}, distance: ${distance}}';
}
AbilityT unpack() => AbilityT(
@@ -692,7 +692,7 @@ class AbilityT implements fb.Packable {
@override
String toString() {
return 'AbilityT{id: $id, distance: $distance}';
return 'AbilityT{id: ${id}, distance: ${distance}}';
}
}
@@ -761,7 +761,7 @@ class StructOfStructs {
@override
String toString() {
return 'StructOfStructs{a: $a, b: $b, c: $c}';
return 'StructOfStructs{a: ${a}, b: ${b}, c: ${c}}';
}
StructOfStructsT unpack() => StructOfStructsT(
@@ -795,7 +795,7 @@ class StructOfStructsT implements fb.Packable {
@override
String toString() {
return 'StructOfStructsT{a: $a, b: $b, c: $c}';
return 'StructOfStructsT{a: ${a}, b: ${b}, c: ${c}}';
}
}
@@ -867,7 +867,7 @@ class StructOfStructsOfStructs {
@override
String toString() {
return 'StructOfStructsOfStructs{a: $a}';
return 'StructOfStructsOfStructs{a: ${a}}';
}
StructOfStructsOfStructsT unpack() => StructOfStructsOfStructsT(
@@ -893,7 +893,7 @@ class StructOfStructsOfStructsT implements fb.Packable {
@override
String toString() {
return 'StructOfStructsOfStructsT{a: $a}';
return 'StructOfStructsOfStructsT{a: ${a}}';
}
}
@@ -961,7 +961,7 @@ class Stat {
@override
String toString() {
return 'Stat{id: $id, val: $val, count: $count}';
return 'Stat{id: ${id}, val: ${val}, count: ${count}}';
}
StatT unpack() => StatT(
@@ -998,7 +998,7 @@ class StatT implements fb.Packable {
@override
String toString() {
return 'StatT{id: $id, val: $val, count: $count}';
return 'StatT{id: ${id}, val: ${val}, count: ${count}}';
}
}
@@ -1087,7 +1087,7 @@ class Referrable {
@override
String toString() {
return 'Referrable{id: $id}';
return 'Referrable{id: ${id}}';
}
ReferrableT unpack() => ReferrableT(
@@ -1114,7 +1114,7 @@ class ReferrableT implements fb.Packable {
@override
String toString() {
return 'ReferrableT{id: $id}';
return 'ReferrableT{id: ${id}}';
}
}
@@ -1261,7 +1261,7 @@ class Monster {
@override
String toString() {
return 'Monster{pos: $pos, mana: $mana, hp: $hp, name: $name, inventory: $inventory, color: $color, testType: $testType, test: $test, test4: $test4, testarrayofstring: $testarrayofstring, testarrayoftables: $testarrayoftables, enemy: $enemy, testnestedflatbuffer: $testnestedflatbuffer, testempty: $testempty, testbool: $testbool, testhashs32Fnv1: $testhashs32Fnv1, testhashu32Fnv1: $testhashu32Fnv1, testhashs64Fnv1: $testhashs64Fnv1, testhashu64Fnv1: $testhashu64Fnv1, testhashs32Fnv1a: $testhashs32Fnv1a, testhashu32Fnv1a: $testhashu32Fnv1a, testhashs64Fnv1a: $testhashs64Fnv1a, testhashu64Fnv1a: $testhashu64Fnv1a, testarrayofbools: $testarrayofbools, testf: $testf, testf2: $testf2, testf3: $testf3, testarrayofstring2: $testarrayofstring2, testarrayofsortedstruct: $testarrayofsortedstruct, flex: $flex, test5: $test5, vectorOfLongs: $vectorOfLongs, vectorOfDoubles: $vectorOfDoubles, parentNamespaceTest: $parentNamespaceTest, vectorOfReferrables: $vectorOfReferrables, singleWeakReference: $singleWeakReference, vectorOfWeakReferences: $vectorOfWeakReferences, vectorOfStrongReferrables: $vectorOfStrongReferrables, coOwningReference: $coOwningReference, vectorOfCoOwningReferences: $vectorOfCoOwningReferences, nonOwningReference: $nonOwningReference, vectorOfNonOwningReferences: $vectorOfNonOwningReferences, anyUniqueType: $anyUniqueType, anyUnique: $anyUnique, anyAmbiguousType: $anyAmbiguousType, anyAmbiguous: $anyAmbiguous, vectorOfEnums: $vectorOfEnums, signedEnum: $signedEnum, testrequirednestedflatbuffer: $testrequirednestedflatbuffer, scalarKeySortedTables: $scalarKeySortedTables, nativeInline: $nativeInline, longEnumNonEnumDefault: $longEnumNonEnumDefault, longEnumNormalDefault: $longEnumNormalDefault}';
return 'Monster{pos: ${pos}, mana: ${mana}, hp: ${hp}, name: ${name}, inventory: ${inventory}, color: ${color}, testType: ${testType}, test: ${test}, test4: ${test4}, testarrayofstring: ${testarrayofstring}, testarrayoftables: ${testarrayoftables}, enemy: ${enemy}, testnestedflatbuffer: ${testnestedflatbuffer}, testempty: ${testempty}, testbool: ${testbool}, testhashs32Fnv1: ${testhashs32Fnv1}, testhashu32Fnv1: ${testhashu32Fnv1}, testhashs64Fnv1: ${testhashs64Fnv1}, testhashu64Fnv1: ${testhashu64Fnv1}, testhashs32Fnv1a: ${testhashs32Fnv1a}, testhashu32Fnv1a: ${testhashu32Fnv1a}, testhashs64Fnv1a: ${testhashs64Fnv1a}, testhashu64Fnv1a: ${testhashu64Fnv1a}, testarrayofbools: ${testarrayofbools}, testf: ${testf}, testf2: ${testf2}, testf3: ${testf3}, testarrayofstring2: ${testarrayofstring2}, testarrayofsortedstruct: ${testarrayofsortedstruct}, flex: ${flex}, test5: ${test5}, vectorOfLongs: ${vectorOfLongs}, vectorOfDoubles: ${vectorOfDoubles}, parentNamespaceTest: ${parentNamespaceTest}, vectorOfReferrables: ${vectorOfReferrables}, singleWeakReference: ${singleWeakReference}, vectorOfWeakReferences: ${vectorOfWeakReferences}, vectorOfStrongReferrables: ${vectorOfStrongReferrables}, coOwningReference: ${coOwningReference}, vectorOfCoOwningReferences: ${vectorOfCoOwningReferences}, nonOwningReference: ${nonOwningReference}, vectorOfNonOwningReferences: ${vectorOfNonOwningReferences}, anyUniqueType: ${anyUniqueType}, anyUnique: ${anyUnique}, anyAmbiguousType: ${anyAmbiguousType}, anyAmbiguous: ${anyAmbiguous}, vectorOfEnums: ${vectorOfEnums}, signedEnum: ${signedEnum}, testrequirednestedflatbuffer: ${testrequirednestedflatbuffer}, scalarKeySortedTables: ${scalarKeySortedTables}, nativeInline: ${nativeInline}, longEnumNonEnumDefault: ${longEnumNonEnumDefault}, longEnumNormalDefault: ${longEnumNormalDefault}}';
}
MonsterT unpack() => MonsterT(
@@ -1560,7 +1560,7 @@ class MonsterT implements fb.Packable {
@override
String toString() {
return 'MonsterT{pos: $pos, mana: $mana, hp: $hp, name: $name, inventory: $inventory, color: $color, testType: $testType, test: $test, test4: $test4, testarrayofstring: $testarrayofstring, testarrayoftables: $testarrayoftables, enemy: $enemy, testnestedflatbuffer: $testnestedflatbuffer, testempty: $testempty, testbool: $testbool, testhashs32Fnv1: $testhashs32Fnv1, testhashu32Fnv1: $testhashu32Fnv1, testhashs64Fnv1: $testhashs64Fnv1, testhashu64Fnv1: $testhashu64Fnv1, testhashs32Fnv1a: $testhashs32Fnv1a, testhashu32Fnv1a: $testhashu32Fnv1a, testhashs64Fnv1a: $testhashs64Fnv1a, testhashu64Fnv1a: $testhashu64Fnv1a, testarrayofbools: $testarrayofbools, testf: $testf, testf2: $testf2, testf3: $testf3, testarrayofstring2: $testarrayofstring2, testarrayofsortedstruct: $testarrayofsortedstruct, flex: $flex, test5: $test5, vectorOfLongs: $vectorOfLongs, vectorOfDoubles: $vectorOfDoubles, parentNamespaceTest: $parentNamespaceTest, vectorOfReferrables: $vectorOfReferrables, singleWeakReference: $singleWeakReference, vectorOfWeakReferences: $vectorOfWeakReferences, vectorOfStrongReferrables: $vectorOfStrongReferrables, coOwningReference: $coOwningReference, vectorOfCoOwningReferences: $vectorOfCoOwningReferences, nonOwningReference: $nonOwningReference, vectorOfNonOwningReferences: $vectorOfNonOwningReferences, anyUniqueType: $anyUniqueType, anyUnique: $anyUnique, anyAmbiguousType: $anyAmbiguousType, anyAmbiguous: $anyAmbiguous, vectorOfEnums: $vectorOfEnums, signedEnum: $signedEnum, testrequirednestedflatbuffer: $testrequirednestedflatbuffer, scalarKeySortedTables: $scalarKeySortedTables, nativeInline: $nativeInline, longEnumNonEnumDefault: $longEnumNonEnumDefault, longEnumNormalDefault: $longEnumNormalDefault}';
return 'MonsterT{pos: ${pos}, mana: ${mana}, hp: ${hp}, name: ${name}, inventory: ${inventory}, color: ${color}, testType: ${testType}, test: ${test}, test4: ${test4}, testarrayofstring: ${testarrayofstring}, testarrayoftables: ${testarrayoftables}, enemy: ${enemy}, testnestedflatbuffer: ${testnestedflatbuffer}, testempty: ${testempty}, testbool: ${testbool}, testhashs32Fnv1: ${testhashs32Fnv1}, testhashu32Fnv1: ${testhashu32Fnv1}, testhashs64Fnv1: ${testhashs64Fnv1}, testhashu64Fnv1: ${testhashu64Fnv1}, testhashs32Fnv1a: ${testhashs32Fnv1a}, testhashu32Fnv1a: ${testhashu32Fnv1a}, testhashs64Fnv1a: ${testhashs64Fnv1a}, testhashu64Fnv1a: ${testhashu64Fnv1a}, testarrayofbools: ${testarrayofbools}, testf: ${testf}, testf2: ${testf2}, testf3: ${testf3}, testarrayofstring2: ${testarrayofstring2}, testarrayofsortedstruct: ${testarrayofsortedstruct}, flex: ${flex}, test5: ${test5}, vectorOfLongs: ${vectorOfLongs}, vectorOfDoubles: ${vectorOfDoubles}, parentNamespaceTest: ${parentNamespaceTest}, vectorOfReferrables: ${vectorOfReferrables}, singleWeakReference: ${singleWeakReference}, vectorOfWeakReferences: ${vectorOfWeakReferences}, vectorOfStrongReferrables: ${vectorOfStrongReferrables}, coOwningReference: ${coOwningReference}, vectorOfCoOwningReferences: ${vectorOfCoOwningReferences}, nonOwningReference: ${nonOwningReference}, vectorOfNonOwningReferences: ${vectorOfNonOwningReferences}, anyUniqueType: ${anyUniqueType}, anyUnique: ${anyUnique}, anyAmbiguousType: ${anyAmbiguousType}, anyAmbiguous: ${anyAmbiguous}, vectorOfEnums: ${vectorOfEnums}, signedEnum: ${signedEnum}, testrequirednestedflatbuffer: ${testrequirednestedflatbuffer}, scalarKeySortedTables: ${scalarKeySortedTables}, nativeInline: ${nativeInline}, longEnumNonEnumDefault: ${longEnumNonEnumDefault}, longEnumNormalDefault: ${longEnumNormalDefault}}';
}
}
@@ -2110,7 +2110,7 @@ class TypeAliases {
@override
String toString() {
return 'TypeAliases{i8: $i8, u8: $u8, i16: $i16, u16: $u16, i32: $i32, u32: $u32, i64: $i64, u64: $u64, f32: $f32, f64: $f64, v8: $v8, vf64: $vf64}';
return 'TypeAliases{i8: ${i8}, u8: ${u8}, i16: ${i16}, u16: ${u16}, i32: ${i32}, u32: ${u32}, i64: ${i64}, u64: ${u64}, f32: ${f32}, f64: ${f64}, v8: ${v8}, vf64: ${vf64}}';
}
TypeAliasesT unpack() => TypeAliasesT(
@@ -2185,7 +2185,7 @@ class TypeAliasesT implements fb.Packable {
@override
String toString() {
return 'TypeAliasesT{i8: $i8, u8: $u8, i16: $i16, u16: $u16, i32: $i32, u32: $u32, i64: $i64, u64: $u64, f32: $f32, f64: $f64, v8: $v8, vf64: $vf64}';
return 'TypeAliasesT{i8: ${i8}, u8: ${u8}, i16: ${i16}, u16: ${u16}, i32: ${i32}, u32: ${u32}, i64: ${i64}, u64: ${u64}, f32: ${f32}, f64: ${f64}, v8: ${v8}, vf64: ${vf64}}';
}
}

View File

@@ -1416,6 +1416,8 @@ void UtilConvertCase() {
"the_quick_brown_fox" },
{ "the_quick_brown_fox", flatbuffers::Case::kKeep,
"the_quick_brown_fox" },
{ "the_quick_brown_fox", flatbuffers::Case::kSnake2,
"the_quick_brown_fox" },
// Tests for some snake_cases where the _ is oddly placed or missing.
{ "single", flatbuffers::Case::kUpperCamel, "Single" },
@@ -1468,6 +1470,12 @@ void UtilConvertCase() {
flatbuffers::Case::kSnake, "abctest" },
{ flatbuffers::Case::kUpperCamel, "tHe_qUiCk_BrOwN_fOx",
flatbuffers::Case::kKeep, "tHe_qUiCk_BrOwN_fOx" },
{ flatbuffers::Case::kLowerCamel, "theQuick12345Fox",
flatbuffers::Case::kSnake, "the_quick_12345fox" },
{ flatbuffers::Case::kLowerCamel, "a12b34c45",
flatbuffers::Case::kSnake, "a_12b_34c_45" },
{ flatbuffers::Case::kLowerCamel, "a12b34c45",
flatbuffers::Case::kSnake2, "a12_b34_c45" },
};
for (auto &test_case : cases) {