mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-02 18:27:46 +00:00
bulk code format fix (#8707)
This commit is contained in:
parent
0e047869da
commit
caf3b494db
559 changed files with 38871 additions and 31276 deletions
|
|
@ -1,26 +1,27 @@
|
|||
import assert from 'assert'
|
||||
import * as flatbuffers from 'flatbuffers'
|
||||
|
||||
import {UnionUnderlyingType as Test} from './union_underlying_type_test.js'
|
||||
|
||||
function main() {
|
||||
let a = new Test.AT();
|
||||
a.a = 1;
|
||||
let b = new Test.BT();
|
||||
b.b = "foo";
|
||||
let c = new Test.CT();
|
||||
c.c = true;
|
||||
let d = new Test.DT();
|
||||
d.testUnionType = Test.ABC.A;
|
||||
d.testUnion = a;
|
||||
d.testVectorOfUnionType = [Test.ABC.A, Test.ABC.B, Test.ABC.C];
|
||||
d.testVectorOfUnion = [a, b, c];
|
||||
let a = new Test.AT();
|
||||
a.a = 1;
|
||||
let b = new Test.BT();
|
||||
b.b = 'foo';
|
||||
let c = new Test.CT();
|
||||
c.c = true;
|
||||
let d = new Test.DT();
|
||||
d.testUnionType = Test.ABC.A;
|
||||
d.testUnion = a;
|
||||
d.testVectorOfUnionType = [Test.ABC.A, Test.ABC.B, Test.ABC.C];
|
||||
d.testVectorOfUnion = [a, b, c];
|
||||
|
||||
let fbb = new flatbuffers.Builder();
|
||||
let offset = d.pack(fbb);
|
||||
fbb.finish(offset);
|
||||
let fbb = new flatbuffers.Builder();
|
||||
let offset = d.pack(fbb);
|
||||
fbb.finish(offset);
|
||||
|
||||
let unpacked = Test.D.getRootAsD(fbb.dataBuffer()).unpack();
|
||||
assert.equal(JSON.stringify(unpacked), JSON.stringify(d));
|
||||
let unpacked = Test.D.getRootAsD(fbb.dataBuffer()).unpack();
|
||||
assert.equal(JSON.stringify(unpacked), JSON.stringify(d));
|
||||
}
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue