Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: test/generated_message_test.dart

Issue 1829573002: Fix all strong mode warnings in protoc-plugin (Closed) Base URL: git@github.com:dart-lang/dart-protoc-plugin.git@master
Patch Set: regenerate pb.dart files Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/file_generator_test.dart ('k') | test/message_generator_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/generated_message_test.dart
diff --git a/test/generated_message_test.dart b/test/generated_message_test.dart
index ca56bc975a5c2a9ee9f4410fe75d76051896d7b2..28305d48b30729b0d7a450e18df5ea062cb9457d 100755
--- a/test/generated_message_test.dart
+++ b/test/generated_message_test.dart
@@ -27,9 +27,9 @@ void main() {
throwsA(new isInstanceOf<InvalidProtocolBufferException>());
test('testProtosShareRepeatedArraysIfDidntChange', () {
TestAllTypes value1 = new TestAllTypes()
- ..repeatedInt32.add(100)
- ..repeatedImportEnum.add(ImportEnum.IMPORT_BAR)
- ..repeatedForeignMessage.add(new ForeignMessage());
+ ..repeatedInt32.add(100)
+ ..repeatedImportEnum.add(ImportEnum.IMPORT_BAR)
+ ..repeatedForeignMessage.add(new ForeignMessage());
TestAllTypes value2 = value1.clone();
@@ -40,32 +40,65 @@ void main() {
test('testSettersRejectNull', () {
TestAllTypes message = new TestAllTypes();
- expect(() { message.optionalString = null; }, throwsArgumentError);
- expect(() { message.optionalBytes = null; }, throwsArgumentError);
- expect(() { message.optionalNestedMessage = null; }, throwsArgumentError);
- expect(() { message.optionalNestedMessage =null; }, throwsArgumentError);
- expect(() { message.optionalNestedEnum = null; }, throwsArgumentError);
- expect(() { message.repeatedString.add(null); }, throwsArgumentError);
- expect(() { message.repeatedBytes.add(null); }, throwsArgumentError);
- expect(() { message.repeatedNestedMessage.add(null); },
- throwsArgumentError);
- expect(() { message.repeatedNestedMessage.add(null); },
- throwsArgumentError);
- expect(() { message.repeatedNestedEnum.add(null); }, throwsArgumentError);
+ expect(() {
+ message.optionalString = null;
+ }, throwsArgumentError);
+ expect(() {
+ message.optionalBytes = null;
+ }, throwsArgumentError);
+ expect(() {
+ message.optionalNestedMessage = null;
+ }, throwsArgumentError);
+ expect(() {
+ message.optionalNestedMessage = null;
+ }, throwsArgumentError);
+ expect(() {
+ message.optionalNestedEnum = null;
+ }, throwsArgumentError);
+ expect(() {
+ message.repeatedString.add(null);
+ }, throwsArgumentError);
+ expect(() {
+ message.repeatedBytes.add(null);
+ }, throwsArgumentError);
+ expect(() {
+ message.repeatedNestedMessage.add(null);
+ }, throwsArgumentError);
+ expect(() {
+ message.repeatedNestedMessage.add(null);
+ }, throwsArgumentError);
+ expect(() {
+ message.repeatedNestedEnum.add(null);
+ }, throwsArgumentError);
});
test('testDefaultMessageIsReadOnly', () {
var message = new TestAllTypes();
- expect(message.optionalNestedMessage, same(TestAllTypes_NestedMessage.getDefault()));
- expect(() { message.optionalNestedMessage.bb = 123; }, throwsUnsupportedError);
+ expect(message.optionalNestedMessage,
+ same(TestAllTypes_NestedMessage.getDefault()));
+ expect(() {
+ message.optionalNestedMessage.bb = 123;
+ }, throwsUnsupportedError);
message = TestAllTypes.getDefault();
- expect(() { message.clear(); }, throwsUnsupportedError);
- expect(() { message.optionalString = "123"; }, throwsUnsupportedError);
- expect(() { message.clearOptionalString(); }, throwsUnsupportedError);
- expect(() { message.repeatedString.add("123"); }, throwsUnsupportedError);
- expect(() { message.repeatedString.clear(); }, throwsUnsupportedError);
- expect(() { message.unknownFields.clear(); }, throwsUnsupportedError);
+ expect(() {
+ message.clear();
+ }, throwsUnsupportedError);
+ expect(() {
+ message.optionalString = "123";
+ }, throwsUnsupportedError);
+ expect(() {
+ message.clearOptionalString();
+ }, throwsUnsupportedError);
+ expect(() {
+ message.repeatedString.add("123");
+ }, throwsUnsupportedError);
+ expect(() {
+ message.repeatedString.clear();
+ }, throwsUnsupportedError);
+ expect(() {
+ message.unknownFields.clear();
+ }, throwsUnsupportedError);
});
test('testRepeatedSetters', () {
@@ -78,21 +111,28 @@ void main() {
TestAllTypes message = new TestAllTypes();
message.repeatedString.addAll(['one', 'two']);
- expect(() { message.repeatedString[1] = null; }, throwsArgumentError);
+ expect(() {
+ message.repeatedString[1] = null;
+ }, throwsArgumentError);
message.repeatedBytes.addAll(['one'.codeUnits, 'two'.codeUnits]);
- expect(() { message.repeatedBytes[1] = null; }, throwsArgumentError);
+ expect(() {
+ message.repeatedBytes[1] = null;
+ }, throwsArgumentError);
message.repeatedNestedMessage.addAll([
- new TestAllTypes_NestedMessage()..bb = 318,
- new TestAllTypes_NestedMessage()..bb = 456]);
- expect(() { message.repeatedNestedMessage[1] = null; },
- throwsArgumentError);
+ new TestAllTypes_NestedMessage()..bb = 318,
+ new TestAllTypes_NestedMessage()..bb = 456
+ ]);
+ expect(() {
+ message.repeatedNestedMessage[1] = null;
+ }, throwsArgumentError);
- message.repeatedNestedEnum.addAll(
- [TestAllTypes_NestedEnum.FOO, TestAllTypes_NestedEnum.BAR]);
- expect(() { message.repeatedNestedEnum[1] = null; },
- throwsArgumentError);
+ message.repeatedNestedEnum
+ .addAll([TestAllTypes_NestedEnum.FOO, TestAllTypes_NestedEnum.BAR]);
+ expect(() {
+ message.repeatedNestedEnum[1] = null;
+ }, throwsArgumentError);
});
test('testRepeatedAppend', () {
@@ -111,18 +151,21 @@ void main() {
TestAllTypes message = new TestAllTypes();
expect(() {
- message.repeatedForeignMessage.addAll([
- new ForeignMessage()..c = 12, null]); }, throwsArgumentError);
+ message.repeatedForeignMessage
+ .addAll([new ForeignMessage()..c = 12, null]);
+ }, throwsArgumentError);
expect(() {
- message.repeatedForeignEnum.addAll([ForeignEnum.FOREIGN_BAZ, null]);
- }, throwsArgumentError);
+ message.repeatedForeignEnum.addAll([ForeignEnum.FOREIGN_BAZ, null]);
+ }, throwsArgumentError);
- expect(() { message.repeatedString.addAll(['one', null]); },
- throwsArgumentError);
+ expect(() {
+ message.repeatedString.addAll(['one', null]);
+ }, throwsArgumentError);
- expect(() { message.repeatedBytes.addAll(['one'.codeUnits, null]); },
- throwsArgumentError);
+ expect(() {
+ message.repeatedBytes.addAll(['one'.codeUnits, null]);
+ }, throwsArgumentError);
});
test('testSettingForeignMessage', () {
@@ -148,8 +191,7 @@ void main() {
test('testDefaults', () {
assertClear(new TestAllTypes());
- TestExtremeDefaultValues message =
- new TestExtremeDefaultValues();
+ TestExtremeDefaultValues message = new TestExtremeDefaultValues();
expect(message.utf8String, '\u1234');
expect(message.infDouble, same(double.INFINITY));
@@ -180,8 +222,8 @@ void main() {
// void testReflectionDefaults() {} // UNSUPPORTED -- until reflection
test('testEnumInterface', () {
- expect(new TestAllTypes().defaultNestedEnum,
- new isInstanceOf<ProtobufEnum>());
+ expect(
+ new TestAllTypes().defaultNestedEnum, new isInstanceOf<ProtobufEnum>());
});
test('testEnumMap', () {
@@ -203,13 +245,14 @@ void main() {
assertPackedFieldsSet(message);
});
- test('testIgnoreJavaMultipleFilesOption', () { // UNSUPPORTED getFile
+ test('testIgnoreJavaMultipleFilesOption', () {
+ // UNSUPPORTED getFile
// We mostly just want to check that things compile.
MessageWithNoOuter message = new MessageWithNoOuter()
- ..nested = (new MessageWithNoOuter_NestedMessage()..i = 1)
- ..foreign.add(new TestAllTypes()..optionalInt32 = 1)
- ..nestedEnum = MessageWithNoOuter_NestedEnum.BAZ
- ..foreignEnum = EnumWithNoOuter.BAR;
+ ..nested = (new MessageWithNoOuter_NestedMessage()..i = 1)
+ ..foreign.add(new TestAllTypes()..optionalInt32 = 1)
+ ..nestedEnum = MessageWithNoOuter_NestedEnum.BAZ
+ ..foreignEnum = EnumWithNoOuter.BAR;
expect(new MessageWithNoOuter.fromBuffer(message.writeToBuffer()), message);
@@ -225,19 +268,25 @@ void main() {
// expect(ServiceWithNoOuter.getDescriptor().getFile()
// MultipleFilesTestProto.getDescriptor());
- expect(new TestAllExtensions().hasExtension(
- Multiple_files_test.extensionWithOuter), isFalse);
+ expect(
+ new TestAllExtensions()
+ .hasExtension(Multiple_files_test.extensionWithOuter),
+ isFalse);
});
test('testOptionalFieldWithRequiredSubfieldsOptimizedForSize', () {
expect(new TestOptionalOptimizedForSize().isInitialized(), isTrue);
- expect((new TestOptionalOptimizedForSize()
- ..o = new TestRequiredOptimizedForSize()).isInitialized(),
+ expect(
+ (new TestOptionalOptimizedForSize()
+ ..o = new TestRequiredOptimizedForSize())
+ .isInitialized(),
isFalse);
- expect((new TestOptionalOptimizedForSize()
- ..o = (new TestRequiredOptimizedForSize()..x = 5)).isInitialized(),
+ expect(
+ (new TestOptionalOptimizedForSize()
+ ..o = (new TestRequiredOptimizedForSize()..x = 5))
+ .isInitialized(),
isTrue);
});
@@ -276,10 +325,10 @@ void main() {
});
test('testMaliciousRecursion', () {
- _makeRecursiveMessage(int depth) {
- return depth == 0 ?
- (new TestRecursiveMessage()..i = 5) :
- (new TestRecursiveMessage()..a = _makeRecursiveMessage(depth - 1));
+ GeneratedMessage _makeRecursiveMessage(int depth) {
+ return depth == 0
+ ? (new TestRecursiveMessage()..i = 5)
+ : (new TestRecursiveMessage()..a = _makeRecursiveMessage(depth - 1));
}
_assertMessageDepth(TestRecursiveMessage message, int depth) {
@@ -297,24 +346,25 @@ void main() {
_assertMessageDepth(new TestRecursiveMessage.fromBuffer(data64), 64);
- expect(() { new TestRecursiveMessage.fromBuffer(data65); },
- throwsInvalidProtocolBufferException);
+ expect(() {
+ new TestRecursiveMessage.fromBuffer(data65);
+ }, throwsInvalidProtocolBufferException);
CodedBufferReader input = new CodedBufferReader(data64, recursionLimit: 8);
expect(() {
- // Uncomfortable alternative to below...
- new TestRecursiveMessage().mergeFromCodedBufferReader(input);
- }, throwsInvalidProtocolBufferException);
+ // Uncomfortable alternative to below...
+ new TestRecursiveMessage().mergeFromCodedBufferReader(input);
+ }, throwsInvalidProtocolBufferException);
});
test('testSizeLimit', () {
- CodedBufferReader input = new CodedBufferReader(
- getAllSet().writeToBuffer(), sizeLimit: 16);
+ CodedBufferReader input =
+ new CodedBufferReader(getAllSet().writeToBuffer(), sizeLimit: 16);
expect(() {
- // Uncomfortable alternative to below...
- new TestAllTypes().mergeFromCodedBufferReader(input);
- }, throwsInvalidProtocolBufferException);
+ // Uncomfortable alternative to below...
+ new TestAllTypes().mergeFromCodedBufferReader(input);
+ }, throwsInvalidProtocolBufferException);
});
test('testSerialize', () {
TestAllTypes expected = getAllSet();
@@ -324,10 +374,11 @@ void main() {
});
test('testEnumValues', () {
- expect(TestAllTypes_NestedEnum.values,
- [ TestAllTypes_NestedEnum.FOO,
- TestAllTypes_NestedEnum.BAR,
- TestAllTypes_NestedEnum.BAZ]);
+ expect(TestAllTypes_NestedEnum.values, [
+ TestAllTypes_NestedEnum.FOO,
+ TestAllTypes_NestedEnum.BAR,
+ TestAllTypes_NestedEnum.BAZ
+ ]);
expect(TestAllTypes_NestedEnum.FOO.value, 1);
expect(TestAllTypes_NestedEnum.BAR.value, 2);
expect(TestAllTypes_NestedEnum.BAZ.value, 3);
@@ -335,78 +386,654 @@ void main() {
test('testWriteWholeMessage', () {
List<int> goldenMessage = const <int>[
- 0x08, 0x65, 0x10, 0x66, 0x18, 0x67, 0x20, 0x68, 0x28, 0xd2, 0x01, 0x30,
- 0xd4, 0x01, 0x3d, 0x6b, 0x00, 0x00, 0x00, 0x41, 0x6c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x4d, 0x6d, 0x00, 0x00, 0x00, 0x51, 0x6e, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0xde, 0x42, 0x61,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x40, 0x68, 0x01, 0x72, 0x03,
- 0x31, 0x31, 0x35, 0x7a, 0x03, 0x31, 0x31, 0x36, 0x83, 0x01, 0x88, 0x01,
- 0x75, 0x84, 0x01, 0x92, 0x01, 0x02, 0x08, 0x76, 0x9a, 0x01, 0x02, 0x08,
- 0x77, 0xa2, 0x01, 0x02, 0x08, 0x78, 0xa8, 0x01, 0x03, 0xb0, 0x01, 0x06,
- 0xb8, 0x01, 0x09, 0xc2, 0x01, 0x03, 0x31, 0x32, 0x34, 0xca, 0x01, 0x03,
- 0x31, 0x32, 0x35, 0xf8, 0x01, 0xc9, 0x01, 0xf8, 0x01, 0xad, 0x02, 0x80,
- 0x02, 0xca, 0x01, 0x80, 0x02, 0xae, 0x02, 0x88, 0x02, 0xcb, 0x01, 0x88,
- 0x02, 0xaf, 0x02, 0x90, 0x02, 0xcc, 0x01, 0x90, 0x02, 0xb0, 0x02, 0x98,
- 0x02, 0x9a, 0x03, 0x98, 0x02, 0xe2, 0x04, 0xa0, 0x02, 0x9c, 0x03, 0xa0,
- 0x02, 0xe4, 0x04, 0xad, 0x02, 0xcf, 0x00, 0x00, 0x00, 0xad, 0x02, 0x33,
- 0x01, 0x00, 0x00, 0xb1, 0x02, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xb1, 0x02, 0x34, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd,
- 0x02, 0xd1, 0x00, 0x00, 0x00, 0xbd, 0x02, 0x35, 0x01, 0x00, 0x00, 0xc1,
- 0x02, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x02, 0x36,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0x02, 0x00, 0x00, 0x53,
- 0x43, 0xcd, 0x02, 0x00, 0x80, 0x9b, 0x43, 0xd1, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x80, 0x6a, 0x40, 0xd1, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x73, 0x40, 0xd8, 0x02, 0x01, 0xd8, 0x02, 0x00, 0xe2, 0x02, 0x03,
- 0x32, 0x31, 0x35, 0xe2, 0x02, 0x03, 0x33, 0x31, 0x35, 0xea, 0x02, 0x03,
- 0x32, 0x31, 0x36, 0xea, 0x02, 0x03, 0x33, 0x31, 0x36, 0xf3, 0x02, 0xf8,
- 0x02, 0xd9, 0x01, 0xf4, 0x02, 0xf3, 0x02, 0xf8, 0x02, 0xbd, 0x02, 0xf4,
- 0x02, 0x82, 0x03, 0x03, 0x08, 0xda, 0x01, 0x82, 0x03, 0x03, 0x08, 0xbe,
- 0x02, 0x8a, 0x03, 0x03, 0x08, 0xdb, 0x01, 0x8a, 0x03, 0x03, 0x08, 0xbf,
- 0x02, 0x92, 0x03, 0x03, 0x08, 0xdc, 0x01, 0x92, 0x03, 0x03, 0x08, 0xc0,
- 0x02, 0x98, 0x03, 0x02, 0x98, 0x03, 0x03, 0xa0, 0x03, 0x05, 0xa0, 0x03,
- 0x06, 0xa8, 0x03, 0x08, 0xa8, 0x03, 0x09, 0xb2, 0x03, 0x03, 0x32, 0x32,
- 0x34, 0xb2, 0x03, 0x03, 0x33, 0x32, 0x34, 0xba, 0x03, 0x03, 0x32, 0x32,
- 0x35, 0xba, 0x03, 0x03, 0x33, 0x32, 0x35, 0xe8, 0x03, 0x91, 0x03, 0xf0,
- 0x03, 0x92, 0x03, 0xf8, 0x03, 0x93, 0x03, 0x80, 0x04, 0x94, 0x03, 0x88,
- 0x04, 0xaa, 0x06, 0x90, 0x04, 0xac, 0x06, 0x9d, 0x04, 0x97, 0x01, 0x00,
- 0x00, 0xa1, 0x04, 0x98, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xad,
- 0x04, 0x99, 0x01, 0x00, 0x00, 0xb1, 0x04, 0x9a, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xbd, 0x04, 0x00, 0x80, 0xcd, 0x43, 0xc1, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc0, 0x79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,
+ 0x03,
+ 0x34,
+ 0x32,
+ 0x34,
+ 0xaa,
+ 0x05,
+ 0x03,
+ 0x34,
+ 0x32,
+ 0x35
];
expect(getAllSet().writeToBuffer(), goldenMessage);
});
test('testWriteWholePackedFieldsMessage', () {
List<int> goldenPackedMessage = const <int>[
- 0xd2, 0x05, 0x04, 0xd9, 0x04, 0xbd, 0x05, 0xda, 0x05, 0x04, 0xda, 0x04,
- 0xbe, 0x05, 0xe2, 0x05, 0x04, 0xdb, 0x04, 0xbf, 0x05, 0xea, 0x05, 0x04,
- 0xdc, 0x04, 0xc0, 0x05, 0xf2, 0x05, 0x04, 0xba, 0x09, 0x82, 0x0b, 0xfa,
- 0x05, 0x04, 0xbc, 0x09, 0x84, 0x0b, 0x82, 0x06, 0x08, 0x5f, 0x02, 0x00,
- 0x00, 0xc3, 0x02, 0x00, 0x00, 0x8a, 0x06, 0x10, 0x60, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc4, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x92, 0x06, 0x08, 0x61, 0x02, 0x00, 0x00, 0xc5, 0x02, 0x00, 0x00, 0x9a,
- 0x06, 0x10, 0x62, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x06, 0x08, 0x00, 0xc0, 0x18,
- 0x44, 0x00, 0xc0, 0x31, 0x44, 0xaa, 0x06, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x83, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x86, 0x40,
- 0xb2, 0x06, 0x02, 0x01, 0x00, 0xba, 0x06, 0x02, 0x05, 0x06
+ 0xd2,
+ 0x05,
+ 0x04,
+ 0xd9,
+ 0x04,
+ 0xbd,
+ 0x05,
+ 0xda,
+ 0x05,
+ 0x04,
+ 0xda,
+ 0x04,
+ 0xbe,
+ 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06,
+ 0x02,
+ 0x05,
+ 0x06
];
expect(getPackedSet().writeToBuffer(), goldenPackedMessage);
});
test('testWriteMessageWithNegativeEnumValue', () {
SparseEnumMessage message = new SparseEnumMessage()
- ..sparseEnum = TestSparseEnum.SPARSE_E;
+ ..sparseEnum = TestSparseEnum.SPARSE_E;
expect(message.sparseEnum.value < 0, isTrue,
reason: 'enum.value should be -53452');
SparseEnumMessage message2 =
new SparseEnumMessage.fromBuffer(message.writeToBuffer());
expect(message2.sparseEnum, TestSparseEnum.SPARSE_E,
- reason: 'should resolve back to SPARSE_E');
+ reason: 'should resolve back to SPARSE_E');
});
test('testReservedNamesOptional', () {
« no previous file with comments | « test/file_generator_test.dart ('k') | test/message_generator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698