start on an upgrade test
This commit is contained in:
parent
389033d1be
commit
4f04fdadd5
2 changed files with 41 additions and 0 deletions
|
@ -68,6 +68,28 @@ class EncodingSuite extends FunSuite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("UpgradeStructInBuilder") {
|
||||||
|
val builder = new MessageBuilder();
|
||||||
|
val root = builder.initRoot(TestAnyPointer.factory);
|
||||||
|
|
||||||
|
|
||||||
|
val oldReader = {
|
||||||
|
val oldVersion = root.getAnyPointerField().initAsStruct(TestOldVersion.factory);
|
||||||
|
oldVersion.setOld1(123);
|
||||||
|
oldVersion.setOld2("foo");
|
||||||
|
val sub = oldVersion.initOld3();
|
||||||
|
sub.setOld1(456);
|
||||||
|
sub.setOld2("bar");
|
||||||
|
oldVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
//val newVersion = root.getAnyPointerField().getAsStruct(TestNewVersion.factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
|
||||||
test("Constants") {
|
test("Constants") {
|
||||||
assert(Void.VOID == TestConstants.VOID_CONST);
|
assert(Void.VOID == TestConstants.VOID_CONST);
|
||||||
assert(true == TestConstants.BOOL_CONST);
|
assert(true == TestConstants.BOOL_CONST);
|
||||||
|
|
|
@ -192,6 +192,25 @@ struct TestGroups {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct TestOldVersion {
|
||||||
|
# A subset of TestNewVersion.
|
||||||
|
old1 @0 :Int64;
|
||||||
|
old2 @1 :Text;
|
||||||
|
old3 @2 :TestOldVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TestNewVersion {
|
||||||
|
# A superset of TestOldVersion.
|
||||||
|
old1 @0 :Int64;
|
||||||
|
old2 @1 :Text;
|
||||||
|
old3 @2 :TestNewVersion;
|
||||||
|
new1 @3 :Int64 = 987;
|
||||||
|
new2 @4 :Text = "baz";
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TestEmptyStruct {}
|
||||||
|
|
||||||
struct TestConstants {
|
struct TestConstants {
|
||||||
const voidConst :Void = void;
|
const voidConst :Void = void;
|
||||||
const boolConst :Bool = true;
|
const boolConst :Bool = true;
|
||||||
|
|
Loading…
Reference in a new issue