From 3ccd35e34ca2bd323745dd7338a729e12a1eec3f Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 18 Aug 2016 18:37:15 -0700 Subject: [PATCH 1/2] fix analyzer warning --- benchmark/lib/suites/json.dart | 2 +- benchmark/lib/suites/props.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/lib/suites/json.dart b/benchmark/lib/suites/json.dart index 17fd37a8f..690855c4f 100644 --- a/benchmark/lib/suites/json.dart +++ b/benchmark/lib/suites/json.dart @@ -12,7 +12,7 @@ import '../benchmarks/string_json.dart'; import '../benchmarks/repeated_string_json.dart'; import '../generated/benchmark.pb.dart' show Suite; -final jsonSuite = () { +final Suite jsonSuite = () { var suite = new Suite(); suite.requests.addAll([ _int32(1, 100), diff --git a/benchmark/lib/suites/props.dart b/benchmark/lib/suites/props.dart index 8e37339ef..54914bfa0 100644 --- a/benchmark/lib/suites/props.dart +++ b/benchmark/lib/suites/props.dart @@ -9,7 +9,7 @@ import '../benchmarks/set_strings.dart'; import '../benchmarks/has_strings.dart'; import '../generated/benchmark.pb.dart' show Suite; -final propsSuite = () { +final Suite propsSuite = () { var suite = new Suite(); suite.requests.addAll([ _getStrings(10, null), From f75bd2a1cc20a29342a12ab809e53a20e6389fa5 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 18 Aug 2016 18:42:25 -0700 Subject: [PATCH 2/2] dartfmt --- lib/file_generator.dart | 1 + test/hash_code_test.dart | 30 +- test/indenting_writer_test.dart | 4 +- test/json_test.dart | 30 +- test/protoc_options_test.dart | 2 +- test/service_test.dart | 1 + test/test_util.dart | 459 +++++++++++++++---------------- test/unknown_field_set_test.dart | 82 +++--- test/wire_format_test.dart | 16 +- 9 files changed, 302 insertions(+), 323 deletions(-) diff --git a/lib/file_generator.dart b/lib/file_generator.dart index 8f8d2f2ab..a424744b9 100644 --- a/lib/file_generator.dart +++ b/lib/file_generator.dart @@ -82,6 +82,7 @@ class FileGenerator extends ProtobufContainer { } return findMixin(name); } + for (var mixin in dartMixins.values) { resolveMixin(mixin.name); } diff --git a/test/hash_code_test.dart b/test/hash_code_test.dart index 41209b24d..36c27125f 100644 --- a/test/hash_code_test.dart +++ b/test/hash_code_test.dart @@ -55,9 +55,9 @@ void main() { test('testHashCodeOptionalEnum', () { var m1 = new TestAllTypes() - ..optionalNestedEnum = TestAllTypes_NestedEnum.BAR; + ..optionalNestedEnum = TestAllTypes_NestedEnum.BAR; var m2 = new TestAllTypes() - ..optionalNestedEnum = TestAllTypes_NestedEnum.BAR; + ..optionalNestedEnum = TestAllTypes_NestedEnum.BAR; expect(m1.hashCode, m2.hashCode); m1.optionalNestedEnum = TestAllTypes_NestedEnum.BAZ; @@ -139,15 +139,15 @@ void main() { test('testHashCodeCombined', () { var m1 = new TestAllTypes() - ..optionalInt32 = 42 - ..optionalInt64 = new Int64(42) - ..optionalString = "Dart" - ..optionalNestedEnum = TestAllTypes_NestedEnum.BAR; - var m2 = new TestAllTypes() - ..optionalInt32 = 42 - ..optionalInt64 = new Int64(42) - ..optionalString = "Dart" - ..optionalNestedEnum = TestAllTypes_NestedEnum.BAR; + ..optionalInt32 = 42 + ..optionalInt64 = new Int64(42) + ..optionalString = "Dart" + ..optionalNestedEnum = TestAllTypes_NestedEnum.BAR; + var m2 = new TestAllTypes() + ..optionalInt32 = 42 + ..optionalInt64 = new Int64(42) + ..optionalString = "Dart" + ..optionalNestedEnum = TestAllTypes_NestedEnum.BAR; expect(m1.hashCode, m2.hashCode); m1.repeatedInt32..add(42)..add(43); @@ -157,11 +157,11 @@ void main() { m1.repeatedString..add("Dart")..add("JavaScript"); m2.repeatedString..add("Dart")..add("JavaScript"); m1.repeatedNestedEnum - ..add(TestAllTypes_NestedEnum.BAR) - ..add(TestAllTypes_NestedEnum.BAZ); + ..add(TestAllTypes_NestedEnum.BAR) + ..add(TestAllTypes_NestedEnum.BAZ); m2.repeatedNestedEnum - ..add(TestAllTypes_NestedEnum.BAR) - ..add(TestAllTypes_NestedEnum.BAZ); + ..add(TestAllTypes_NestedEnum.BAR) + ..add(TestAllTypes_NestedEnum.BAZ); expect(m1.hashCode, m2.hashCode); m1.unknownFields.mergeVarintField(12345, new Int64(123)); diff --git a/test/indenting_writer_test.dart b/test/indenting_writer_test.dart index 61f0427ff..5bbfeba86 100755 --- a/test/indenting_writer_test.dart +++ b/test/indenting_writer_test.dart @@ -17,7 +17,9 @@ void main() { out.println('second;'); }); - expect(out.toString(), ''' + expect( + out.toString(), + ''' class test { first; diff --git a/test/json_test.dart b/test/json_test.dart index e595988df..155421f06 100755 --- a/test/json_test.dart +++ b/test/json_test.dart @@ -44,42 +44,42 @@ void main() { // Test empty list. expect(getAllSet()..repeatedBool.clear(), - expectedJson('"43":[true,false],', '')); + expectedJson('"43":[true,false],', '')); // Test negative number. expect(getAllSet()..optionalInt32 = -1234567, - expectedJson(':101,', ':-1234567,')); + expectedJson(':101,', ':-1234567,')); // 64-bit numbers outside 53-bit range are quoted. expect(getAllSet()..optionalInt64 = make64(0, 0x200000), - expectedJson(':102,', ':9007199254740992,')); + expectedJson(':102,', ':9007199254740992,')); expect(getAllSet()..optionalInt64 = make64(1, 0x200000), - expectedJson(':102,', ':"9007199254740993",')); + expectedJson(':102,', ':"9007199254740993",')); expect(getAllSet()..optionalInt64 = -make64(0, 0x200000), - expectedJson(':102,', ':-9007199254740992,')); + expectedJson(':102,', ':-9007199254740992,')); expect(getAllSet()..optionalInt64 = -make64(1, 0x200000), - expectedJson(':102,', ':"-9007199254740993",')); + expectedJson(':102,', ':"-9007199254740993",')); // Quotes, backslashes, and control characters in strings are quoted. expect(getAllSet()..optionalString = 'a\u0000b\u0001cd\\e\"fg', - expectedJson(':"115",', ':"a\\u0000b\\u0001cd\\\\e\\"fg",')); + expectedJson(':"115",', ':"a\\u0000b\\u0001cd\\\\e\\"fg",')); }); test('testBase64Encode', () { expect(getAllSet()..optionalBytes = 'Hello, world'.codeUnits, - expectedJson(':"MTE2",', ':"SGVsbG8sIHdvcmxk",')); + expectedJson(':"MTE2",', ':"SGVsbG8sIHdvcmxk",')); expect(getAllSet()..optionalBytes = 'Hello, world!'.codeUnits, - expectedJson(':"MTE2",', ':"SGVsbG8sIHdvcmxkIQ==",')); + expectedJson(':"MTE2",', ':"SGVsbG8sIHdvcmxkIQ==",')); expect(getAllSet()..optionalBytes = 'Hello, world!!'.codeUnits, - expectedJson(':"MTE2",', ':"SGVsbG8sIHdvcmxkISE=",')); + expectedJson(':"MTE2",', ':"SGVsbG8sIHdvcmxkISE=",')); // An empty list should not appear in the output. expect(getAllSet()..optionalBytes = [], expectedJson('"15":"MTE2",', '')); expect(getAllSet()..optionalBytes = 'a'.codeUnits, - expectedJson(':"MTE2",', ':"YQ==",')); + expectedJson(':"MTE2",', ':"YQ==",')); }); test('testBase64Decode', () { @@ -91,11 +91,11 @@ void main() { expect(optionalBytes(':"MTE2",', ':"SGVsbG8sIHdvcmxk",'), 'Hello, world'); - expect(optionalBytes(':"MTE2",', ':"SGVsbG8sIHdvcmxkIQ==",'), - 'Hello, world!'); + expect( + optionalBytes(':"MTE2",', ':"SGVsbG8sIHdvcmxkIQ==",'), 'Hello, world!'); expect(optionalBytes(':"MTE2",', ':"SGVsbG8sIHdvcmxkISE=",'), - 'Hello, world!!'); + 'Hello, world!!'); // Remove optionalBytes tag, reads back as empty list, hence empty string. expect(optionalBytes('"15":"MTE2",', ''), isEmpty); @@ -117,6 +117,6 @@ void main() { test('testExtensionsParse', () { ExtensionRegistry registry = getExtensionRegistry(); expect(new TestAllExtensions.fromJson(TEST_ALL_TYPES_JSON, registry), - getAllExtensionsSet()); + getAllExtensionsSet()); }); } diff --git a/test/protoc_options_test.dart b/test/protoc_options_test.dart index b4f516da3..06a332a20 100644 --- a/test/protoc_options_test.dart +++ b/test/protoc_options_test.dart @@ -28,7 +28,7 @@ void main() { }); test('testInvalidGeneratorOptions', () { - checkInvalid(String parameter) { + checkInvalid(String parameter) { var request = new CodeGeneratorRequest(); if (parameter != null) request.parameter = parameter; var response = new CodeGeneratorResponse(); diff --git a/test/service_test.dart b/test/service_test.dart index a4aedd771..05edda01a 100644 --- a/test/service_test.dart +++ b/test/service_test.dart @@ -113,6 +113,7 @@ void main() { var descriptor = new DescriptorProto()..mergeFromJsonMap(json); return descriptor.name; } + expect(readMessageName('.SearchRequest'), "SearchRequest"); expect(readMessageName('.service2.SearchRequest'), "SearchRequest"); expect(readMessageName('.service3.SearchResult'), "SearchResult"); diff --git a/test/test_util.dart b/test/test_util.dart index 4e608ed47..05cc44a22 100644 --- a/test/test_util.dart +++ b/test/test_util.dart @@ -11,7 +11,6 @@ import 'package:test/test.dart'; import '../out/protos/google/protobuf/unittest_import.pb.dart'; import '../out/protos/google/protobuf/unittest.pb.dart'; - Int64 make64(lo, [hi = null]) { if (hi == null) hi = lo < 0 ? -1 : 0; return new Int64.fromInts(hi, lo); @@ -43,8 +42,8 @@ void assertAllExtensionsSet(TestAllExtensions message) { expect(message.hasExtension(Unittest.optionalGroupExtension), isTrue); expect(message.hasExtension(Unittest.optionalNestedMessageExtension), isTrue); - expect(message.hasExtension(Unittest.optionalForeignMessageExtension), - isTrue); + expect( + message.hasExtension(Unittest.optionalForeignMessageExtension), isTrue); expect(message.hasExtension(Unittest.optionalImportMessageExtension), isTrue); expect(message.getExtension(Unittest.optionalGroupExtension).hasA(), isTrue); @@ -69,17 +68,17 @@ void assertAllExtensionsSet(TestAllExtensions message) { expect(message.getExtension(Unittest.optionalSint32Extension), 105); expect(message.getExtension(Unittest.optionalSint64Extension), expect64(106)); expect(message.getExtension(Unittest.optionalFixed32Extension), 107); - expect(message.getExtension(Unittest.optionalFixed64Extension), - expect64(108)); + expect( + message.getExtension(Unittest.optionalFixed64Extension), expect64(108)); expect(message.getExtension(Unittest.optionalSfixed32Extension), 109); - expect(message.getExtension(Unittest.optionalSfixed64Extension), - expect64(110)); + expect( + message.getExtension(Unittest.optionalSfixed64Extension), expect64(110)); expect(message.getExtension(Unittest.optionalFloatExtension), 111.0); expect(message.getExtension(Unittest.optionalDoubleExtension), 112.0); expect(message.getExtension(Unittest.optionalBoolExtension), true); expect(message.getExtension(Unittest.optionalStringExtension), '115'); - expect(message.getExtension(Unittest.optionalBytesExtension), - '116'.codeUnits); + expect( + message.getExtension(Unittest.optionalBytesExtension), '116'.codeUnits); expect(message.getExtension(Unittest.optionalGroupExtension).a, 117); expect(message.getExtension(Unittest.optionalNestedMessageExtension).bb, 118); @@ -87,16 +86,14 @@ void assertAllExtensionsSet(TestAllExtensions message) { expect(message.getExtension(Unittest.optionalImportMessageExtension).d, 120); expect(message.getExtension(Unittest.optionalNestedEnumExtension), - TestAllTypes_NestedEnum.BAZ); + TestAllTypes_NestedEnum.BAZ); expect(message.getExtension(Unittest.optionalForeignEnumExtension), - ForeignEnum.FOREIGN_BAZ); + ForeignEnum.FOREIGN_BAZ); expect(message.getExtension(Unittest.optionalImportEnumExtension), - ImportEnum.IMPORT_BAZ); + ImportEnum.IMPORT_BAZ); - expect(message.getExtension(Unittest.optionalStringPieceExtension), - '124'); - expect(message.getExtension(Unittest.optionalCordExtension), - '125'); + expect(message.getExtension(Unittest.optionalStringPieceExtension), '124'); + expect(message.getExtension(Unittest.optionalCordExtension), '125'); // ----------------------------------------------------------------- @@ -117,12 +114,12 @@ void assertAllExtensionsSet(TestAllExtensions message) { expect(message.getExtension(Unittest.repeatedBytesExtension).length, 2); expect(message.getExtension(Unittest.repeatedGroupExtension).length, 2); - expect(message.getExtension(Unittest.repeatedNestedMessageExtension).length, - 2); - expect(message.getExtension(Unittest.repeatedForeignMessageExtension).length, - 2); - expect(message.getExtension(Unittest.repeatedImportMessageExtension).length, - 2); + expect( + message.getExtension(Unittest.repeatedNestedMessageExtension).length, 2); + expect( + message.getExtension(Unittest.repeatedForeignMessageExtension).length, 2); + expect( + message.getExtension(Unittest.repeatedImportMessageExtension).length, 2); expect(message.getExtension(Unittest.repeatedNestedEnumExtension).length, 2); expect(message.getExtension(Unittest.repeatedForeignEnumExtension).length, 2); expect(message.getExtension(Unittest.repeatedImportEnumExtension).length, 2); @@ -131,81 +128,81 @@ void assertAllExtensionsSet(TestAllExtensions message) { expect(message.getExtension(Unittest.repeatedCordExtension).length, 2); expect(message.getExtension(Unittest.repeatedInt32Extension)[0], 201); - expect(message.getExtension(Unittest.repeatedInt64Extension)[0], - expect64(202)); + expect( + message.getExtension(Unittest.repeatedInt64Extension)[0], expect64(202)); expect(message.getExtension(Unittest.repeatedUint32Extension)[0], 203); - expect(message.getExtension(Unittest.repeatedUint64Extension)[0], - expect64(204)); + expect( + message.getExtension(Unittest.repeatedUint64Extension)[0], expect64(204)); expect(message.getExtension(Unittest.repeatedSint32Extension)[0], 205); - expect(message.getExtension(Unittest.repeatedSint64Extension)[0], - expect64(206)); + expect( + message.getExtension(Unittest.repeatedSint64Extension)[0], expect64(206)); expect(message.getExtension(Unittest.repeatedFixed32Extension)[0], 207); expect(message.getExtension(Unittest.repeatedFixed64Extension)[0], - expect64(208)); + expect64(208)); expect(message.getExtension(Unittest.repeatedSfixed32Extension)[0], 209); expect(message.getExtension(Unittest.repeatedSfixed64Extension)[0], - expect64(210)); + expect64(210)); expect(message.getExtension(Unittest.repeatedFloatExtension)[0], 211.0); expect(message.getExtension(Unittest.repeatedDoubleExtension)[0], 212.0); expect(message.getExtension(Unittest.repeatedBoolExtension)[0], true); expect(message.getExtension(Unittest.repeatedStringExtension)[0], '215'); expect(message.getExtension(Unittest.repeatedBytesExtension)[0], - '216'.codeUnits); + '216'.codeUnits); expect(message.getExtension(Unittest.repeatedGroupExtension)[0].a, 217); - expect(message.getExtension(Unittest.repeatedNestedMessageExtension)[0].bb, - 218); - expect(message.getExtension(Unittest.repeatedForeignMessageExtension)[0].c, - 219); - expect(message.getExtension(Unittest.repeatedImportMessageExtension)[0].d, - 220); + expect( + message.getExtension(Unittest.repeatedNestedMessageExtension)[0].bb, 218); + expect( + message.getExtension(Unittest.repeatedForeignMessageExtension)[0].c, 219); + expect( + message.getExtension(Unittest.repeatedImportMessageExtension)[0].d, 220); expect(message.getExtension(Unittest.repeatedNestedEnumExtension)[0], - TestAllTypes_NestedEnum.BAR); + TestAllTypes_NestedEnum.BAR); expect(message.getExtension(Unittest.repeatedForeignEnumExtension)[0], - ForeignEnum.FOREIGN_BAR); + ForeignEnum.FOREIGN_BAR); expect(message.getExtension(Unittest.repeatedImportEnumExtension)[0], - ImportEnum.IMPORT_BAR); + ImportEnum.IMPORT_BAR); expect(message.getExtension(Unittest.repeatedStringPieceExtension)[0], '224'); expect(message.getExtension(Unittest.repeatedCordExtension)[0], '225'); expect(message.getExtension(Unittest.repeatedInt32Extension)[1], 301); - expect(message.getExtension(Unittest.repeatedInt64Extension)[1], - expect64(302)); + expect( + message.getExtension(Unittest.repeatedInt64Extension)[1], expect64(302)); expect(message.getExtension(Unittest.repeatedUint32Extension)[1], 303); - expect(message.getExtension(Unittest.repeatedUint64Extension)[1], - expect64(304)); + expect( + message.getExtension(Unittest.repeatedUint64Extension)[1], expect64(304)); expect(message.getExtension(Unittest.repeatedSint32Extension)[1], 305); - expect(message.getExtension(Unittest.repeatedSint64Extension)[1], - expect64(306)); + expect( + message.getExtension(Unittest.repeatedSint64Extension)[1], expect64(306)); expect(message.getExtension(Unittest.repeatedFixed32Extension)[1], 307); expect(message.getExtension(Unittest.repeatedFixed64Extension)[1], - expect64(308)); + expect64(308)); expect(message.getExtension(Unittest.repeatedSfixed32Extension)[1], 309); expect(message.getExtension(Unittest.repeatedSfixed64Extension)[1], - expect64(310)); + expect64(310)); expect(message.getExtension(Unittest.repeatedFloatExtension)[1], 311.0); expect(message.getExtension(Unittest.repeatedDoubleExtension)[1], 312.0); expect(message.getExtension(Unittest.repeatedBoolExtension)[1], false); expect(message.getExtension(Unittest.repeatedStringExtension)[1], '315'); expect(message.getExtension(Unittest.repeatedBytesExtension)[1], - '316'.codeUnits); + '316'.codeUnits); expect(message.getExtension(Unittest.repeatedGroupExtension)[1].a, 317); - expect(message.getExtension(Unittest.repeatedNestedMessageExtension)[1].bb, - 318); - expect(message.getExtension(Unittest.repeatedForeignMessageExtension)[1].c, - 319); - expect(message.getExtension(Unittest.repeatedImportMessageExtension)[1].d, - 320); + expect( + message.getExtension(Unittest.repeatedNestedMessageExtension)[1].bb, 318); + expect( + message.getExtension(Unittest.repeatedForeignMessageExtension)[1].c, 319); + expect( + message.getExtension(Unittest.repeatedImportMessageExtension)[1].d, 320); expect(message.getExtension(Unittest.repeatedNestedEnumExtension)[1], - TestAllTypes_NestedEnum.BAZ); + TestAllTypes_NestedEnum.BAZ); expect(message.getExtension(Unittest.repeatedForeignEnumExtension)[1], - ForeignEnum.FOREIGN_BAZ); + ForeignEnum.FOREIGN_BAZ); expect(message.getExtension(Unittest.repeatedImportEnumExtension)[1], - ImportEnum.IMPORT_BAZ); + ImportEnum.IMPORT_BAZ); expect(message.getExtension(Unittest.repeatedStringPieceExtension)[1], '324'); expect(message.getExtension(Unittest.repeatedCordExtension)[1], '325'); @@ -235,20 +232,16 @@ void assertAllExtensionsSet(TestAllExtensions message) { expect(message.hasExtension(Unittest.defaultStringPieceExtension), isTrue); expect(message.hasExtension(Unittest.defaultCordExtension), isTrue); expect(message.getExtension(Unittest.defaultInt32Extension), 401); - expect(message.getExtension(Unittest.defaultInt64Extension), - expect64(402)); + expect(message.getExtension(Unittest.defaultInt64Extension), expect64(402)); expect(message.getExtension(Unittest.defaultUint32Extension), 403); - expect(message.getExtension(Unittest.defaultUint64Extension), - expect64(404)); + expect(message.getExtension(Unittest.defaultUint64Extension), expect64(404)); expect(message.getExtension(Unittest.defaultSint32Extension), 405); - expect(message.getExtension(Unittest.defaultSint64Extension), - expect64(406)); + expect(message.getExtension(Unittest.defaultSint64Extension), expect64(406)); expect(message.getExtension(Unittest.defaultFixed32Extension), 407); - expect(message.getExtension(Unittest.defaultFixed64Extension), - expect64(408)); + expect(message.getExtension(Unittest.defaultFixed64Extension), expect64(408)); expect(message.getExtension(Unittest.defaultSfixed32Extension), 409); - expect(message.getExtension(Unittest.defaultSfixed64Extension), - expect64(410)); + expect( + message.getExtension(Unittest.defaultSfixed64Extension), expect64(410)); expect(message.getExtension(Unittest.defaultFloatExtension), 411.0); expect(message.getExtension(Unittest.defaultDoubleExtension), 412.0); expect(message.getExtension(Unittest.defaultBoolExtension), false); @@ -256,11 +249,11 @@ void assertAllExtensionsSet(TestAllExtensions message) { expect(message.getExtension(Unittest.defaultBytesExtension), '416'.codeUnits); expect(message.getExtension(Unittest.defaultNestedEnumExtension), - TestAllTypes_NestedEnum.FOO); + TestAllTypes_NestedEnum.FOO); expect(message.getExtension(Unittest.defaultForeignEnumExtension), - ForeignEnum.FOREIGN_FOO); + ForeignEnum.FOREIGN_FOO); expect(message.getExtension(Unittest.defaultImportEnumExtension), - ImportEnum.IMPORT_FOO); + ImportEnum.IMPORT_FOO); expect(message.getExtension(Unittest.defaultStringPieceExtension), '424'); expect(message.getExtension(Unittest.defaultCordExtension), '425'); @@ -624,12 +617,12 @@ void assertExtensionsClear(TestAllExtensions message) { expect(message.hasExtension(Unittest.optionalBytesExtension), isFalse); expect(message.hasExtension(Unittest.optionalGroupExtension), isFalse); - expect(message.hasExtension(Unittest.optionalNestedMessageExtension), - isFalse); - expect(message.hasExtension(Unittest.optionalForeignMessageExtension), - isFalse); - expect(message.hasExtension(Unittest.optionalImportMessageExtension), - isFalse); + expect( + message.hasExtension(Unittest.optionalNestedMessageExtension), isFalse); + expect( + message.hasExtension(Unittest.optionalForeignMessageExtension), isFalse); + expect( + message.hasExtension(Unittest.optionalImportMessageExtension), isFalse); expect(message.hasExtension(Unittest.optionalNestedEnumExtension), isFalse); expect(message.hasExtension(Unittest.optionalForeignEnumExtension), isFalse); @@ -648,8 +641,7 @@ void assertExtensionsClear(TestAllExtensions message) { expect(message.getExtension(Unittest.optionalFixed32Extension), 0); expect(message.getExtension(Unittest.optionalFixed64Extension), expect64(0)); expect(message.getExtension(Unittest.optionalSfixed32Extension), 0); - expect(message.getExtension(Unittest.optionalSfixed64Extension), - expect64(0)); + expect(message.getExtension(Unittest.optionalSfixed64Extension), expect64(0)); expect(message.getExtension(Unittest.optionalFloatExtension), 0.0); expect(message.getExtension(Unittest.optionalDoubleExtension), 0.0); expect(message.getExtension(Unittest.optionalBoolExtension), false); @@ -672,11 +664,11 @@ void assertExtensionsClear(TestAllExtensions message) { // Enums without defaults are set to the first value in the enum. expect(message.getExtension(Unittest.optionalNestedEnumExtension), - TestAllTypes_NestedEnum.FOO); + TestAllTypes_NestedEnum.FOO); expect(message.getExtension(Unittest.optionalForeignEnumExtension), - ForeignEnum.FOREIGN_FOO); + ForeignEnum.FOREIGN_FOO); expect(message.getExtension(Unittest.optionalImportEnumExtension), - ImportEnum.IMPORT_FOO); + ImportEnum.IMPORT_FOO); expect(message.getExtension(Unittest.optionalStringPieceExtension), ''); expect(message.getExtension(Unittest.optionalCordExtension), ''); @@ -699,12 +691,12 @@ void assertExtensionsClear(TestAllExtensions message) { expect(message.getExtension(Unittest.repeatedBytesExtension).length, 0); expect(message.getExtension(Unittest.repeatedGroupExtension).length, 0); - expect(message.getExtension(Unittest.repeatedNestedMessageExtension).length, - 0); - expect(message.getExtension(Unittest.repeatedForeignMessageExtension).length, - 0); - expect(message.getExtension(Unittest.repeatedImportMessageExtension).length, - 0); + expect( + message.getExtension(Unittest.repeatedNestedMessageExtension).length, 0); + expect( + message.getExtension(Unittest.repeatedForeignMessageExtension).length, 0); + expect( + message.getExtension(Unittest.repeatedImportMessageExtension).length, 0); expect(message.getExtension(Unittest.repeatedNestedEnumExtension).length, 0); expect(message.getExtension(Unittest.repeatedForeignEnumExtension).length, 0); expect(message.getExtension(Unittest.repeatedImportEnumExtension).length, 0); @@ -730,12 +722,12 @@ void assertExtensionsClear(TestAllExtensions message) { expect(message.getExtension(Unittest.repeatedBytesExtension).length, 0); expect(message.getExtension(Unittest.repeatedGroupExtension).length, 0); - expect(message.getExtension(Unittest.repeatedNestedMessageExtension).length, - 0); - expect(message.getExtension(Unittest.repeatedForeignMessageExtension).length, - 0); - expect(message.getExtension(Unittest.repeatedImportMessageExtension).length, - 0); + expect( + message.getExtension(Unittest.repeatedNestedMessageExtension).length, 0); + expect( + message.getExtension(Unittest.repeatedForeignMessageExtension).length, 0); + expect( + message.getExtension(Unittest.repeatedImportMessageExtension).length, 0); expect(message.getExtension(Unittest.repeatedNestedEnumExtension).length, 0); expect(message.getExtension(Unittest.repeatedForeignEnumExtension).length, 0); expect(message.getExtension(Unittest.repeatedImportEnumExtension).length, 0); @@ -777,20 +769,21 @@ void assertExtensionsClear(TestAllExtensions message) { expect(message.getExtension(Unittest.defaultFixed32Extension), 47); expect(message.getExtension(Unittest.defaultFixed64Extension), expect64(48)); expect(message.getExtension(Unittest.defaultSfixed32Extension), 49); - expect(message.getExtension(Unittest.defaultSfixed64Extension), expect64(-50)); + expect( + message.getExtension(Unittest.defaultSfixed64Extension), expect64(-50)); expect(message.getExtension(Unittest.defaultFloatExtension), 51.5); expect(message.getExtension(Unittest.defaultDoubleExtension), 52e3); expect(message.getExtension(Unittest.defaultBoolExtension), true); expect(message.getExtension(Unittest.defaultStringExtension), 'hello'); - expect(message.getExtension(Unittest.defaultBytesExtension), - 'world'.codeUnits); + expect( + message.getExtension(Unittest.defaultBytesExtension), 'world'.codeUnits); expect(message.getExtension(Unittest.defaultNestedEnumExtension), - TestAllTypes_NestedEnum.BAR); + TestAllTypes_NestedEnum.BAR); expect(message.getExtension(Unittest.defaultForeignEnumExtension), - ForeignEnum.FOREIGN_BAR); + ForeignEnum.FOREIGN_BAR); expect(message.getExtension(Unittest.defaultImportEnumExtension), - ImportEnum.IMPORT_BAR); + ImportEnum.IMPORT_BAR); expect(message.getExtension(Unittest.defaultStringPieceExtension), 'abc'); expect(message.getExtension(Unittest.defaultCordExtension), '123'); @@ -812,45 +805,43 @@ void assertPackedExtensionsSet(TestPackedExtensions message) { expect(message.getExtension(Unittest.packedBoolExtension).length, 2); expect(message.getExtension(Unittest.packedEnumExtension).length, 2); expect(message.getExtension(Unittest.packedInt32Extension)[0], 601); - expect(message.getExtension(Unittest.packedInt64Extension)[0], - expect64(602)); + expect(message.getExtension(Unittest.packedInt64Extension)[0], expect64(602)); expect(message.getExtension(Unittest.packedUint32Extension)[0], 603); - expect(message.getExtension(Unittest.packedUint64Extension)[0], - expect64(604)); + expect( + message.getExtension(Unittest.packedUint64Extension)[0], expect64(604)); expect(message.getExtension(Unittest.packedSint32Extension)[0], 605); - expect(message.getExtension(Unittest.packedSint64Extension)[0], - expect64(606)); + expect( + message.getExtension(Unittest.packedSint64Extension)[0], expect64(606)); expect(message.getExtension(Unittest.packedFixed32Extension)[0], 607); - expect(message.getExtension(Unittest.packedFixed64Extension)[0], - expect64(608)); + expect( + message.getExtension(Unittest.packedFixed64Extension)[0], expect64(608)); expect(message.getExtension(Unittest.packedSfixed32Extension)[0], 609); - expect(message.getExtension(Unittest.packedSfixed64Extension)[0], - expect64(610)); + expect( + message.getExtension(Unittest.packedSfixed64Extension)[0], expect64(610)); expect(message.getExtension(Unittest.packedFloatExtension)[0], 611.0); expect(message.getExtension(Unittest.packedDoubleExtension)[0], 612.0); expect(message.getExtension(Unittest.packedBoolExtension)[0], true); expect(message.getExtension(Unittest.packedEnumExtension)[0], - ForeignEnum.FOREIGN_BAR); + ForeignEnum.FOREIGN_BAR); expect(message.getExtension(Unittest.packedInt32Extension)[1], 701); - expect(message.getExtension(Unittest.packedInt64Extension)[1], - expect64(702)); + expect(message.getExtension(Unittest.packedInt64Extension)[1], expect64(702)); expect(message.getExtension(Unittest.packedUint32Extension)[1], 703); - expect(message.getExtension(Unittest.packedUint64Extension)[1], - expect64(704)); + expect( + message.getExtension(Unittest.packedUint64Extension)[1], expect64(704)); expect(message.getExtension(Unittest.packedSint32Extension)[1], 705); - expect(message.getExtension(Unittest.packedSint64Extension)[1], - expect64(706)); + expect( + message.getExtension(Unittest.packedSint64Extension)[1], expect64(706)); expect(message.getExtension(Unittest.packedFixed32Extension)[1], 707); - expect(message.getExtension(Unittest.packedFixed64Extension)[1], - expect64(708)); + expect( + message.getExtension(Unittest.packedFixed64Extension)[1], expect64(708)); expect(message.getExtension(Unittest.packedSfixed32Extension)[1], 709); - expect(message.getExtension(Unittest.packedSfixed64Extension)[1], - expect64(710)); + expect( + message.getExtension(Unittest.packedSfixed64Extension)[1], expect64(710)); expect(message.getExtension(Unittest.packedFloatExtension)[1], 711.0); expect(message.getExtension(Unittest.packedDoubleExtension)[1], 712.0); expect(message.getExtension(Unittest.packedBoolExtension)[1], false); expect(message.getExtension(Unittest.packedEnumExtension)[1], - ForeignEnum.FOREIGN_BAZ); + ForeignEnum.FOREIGN_BAZ); } /** @@ -921,8 +912,8 @@ void assertRepeatedExtensionsModified(TestAllExtensions message) { expect(message.hasExtension(Unittest.optionalGroupExtension), isTrue); expect(message.hasExtension(Unittest.optionalNestedMessageExtension), isTrue); - expect(message.hasExtension(Unittest.optionalForeignMessageExtension), - isTrue); + expect( + message.hasExtension(Unittest.optionalForeignMessageExtension), isTrue); expect(message.hasExtension(Unittest.optionalImportMessageExtension), isTrue); expect(message.getExtension(Unittest.optionalGroupExtension).hasA(), isTrue); @@ -943,23 +934,21 @@ void assertRepeatedExtensionsModified(TestAllExtensions message) { expect(message.getExtension(Unittest.optionalInt32Extension), 101); expect(message.getExtension(Unittest.optionalInt64Extension), expect64(102)); expect(message.getExtension(Unittest.optionalUint32Extension), 103); - expect(message.getExtension(Unittest.optionalUint64Extension), - expect64(104)); + expect(message.getExtension(Unittest.optionalUint64Extension), expect64(104)); expect(message.getExtension(Unittest.optionalSint32Extension), 105); - expect(message.getExtension(Unittest.optionalSint64Extension), - expect64(106)); + expect(message.getExtension(Unittest.optionalSint64Extension), expect64(106)); expect(message.getExtension(Unittest.optionalFixed32Extension), 107); - expect(message.getExtension(Unittest.optionalFixed64Extension), - expect64(108)); + expect( + message.getExtension(Unittest.optionalFixed64Extension), expect64(108)); expect(message.getExtension(Unittest.optionalSfixed32Extension), 109); - expect(message.getExtension(Unittest.optionalSfixed64Extension), - expect64(110)); + expect( + message.getExtension(Unittest.optionalSfixed64Extension), expect64(110)); expect(message.getExtension(Unittest.optionalFloatExtension), 111.0); expect(message.getExtension(Unittest.optionalDoubleExtension), 112.0); expect(message.getExtension(Unittest.optionalBoolExtension), true); expect(message.getExtension(Unittest.optionalStringExtension), '115'); - expect(message.getExtension(Unittest.optionalBytesExtension), - '116'.codeUnits); + expect( + message.getExtension(Unittest.optionalBytesExtension), '116'.codeUnits); expect(message.getExtension(Unittest.optionalGroupExtension).a, 117); expect(message.getExtension(Unittest.optionalNestedMessageExtension).bb, 118); @@ -967,11 +956,11 @@ void assertRepeatedExtensionsModified(TestAllExtensions message) { expect(message.getExtension(Unittest.optionalImportMessageExtension).d, 120); expect(message.getExtension(Unittest.optionalNestedEnumExtension), - TestAllTypes_NestedEnum.BAZ); + TestAllTypes_NestedEnum.BAZ); expect(message.getExtension(Unittest.optionalForeignEnumExtension), - ForeignEnum.FOREIGN_BAZ); + ForeignEnum.FOREIGN_BAZ); expect(message.getExtension(Unittest.optionalImportEnumExtension), - ImportEnum.IMPORT_BAZ); + ImportEnum.IMPORT_BAZ); expect(message.getExtension(Unittest.optionalStringPieceExtension), '124'); expect(message.getExtension(Unittest.optionalCordExtension), '125'); @@ -995,12 +984,12 @@ void assertRepeatedExtensionsModified(TestAllExtensions message) { expect(message.getExtension(Unittest.repeatedBytesExtension).length, 2); expect(message.getExtension(Unittest.repeatedGroupExtension).length, 2); - expect(message.getExtension(Unittest.repeatedNestedMessageExtension).length, - 2); - expect(message.getExtension(Unittest.repeatedForeignMessageExtension).length, - 2); - expect(message.getExtension(Unittest.repeatedImportMessageExtension).length, - 2); + expect( + message.getExtension(Unittest.repeatedNestedMessageExtension).length, 2); + expect( + message.getExtension(Unittest.repeatedForeignMessageExtension).length, 2); + expect( + message.getExtension(Unittest.repeatedImportMessageExtension).length, 2); expect(message.getExtension(Unittest.repeatedNestedEnumExtension).length, 2); expect(message.getExtension(Unittest.repeatedForeignEnumExtension).length, 2); expect(message.getExtension(Unittest.repeatedImportEnumExtension).length, 2); @@ -1009,81 +998,81 @@ void assertRepeatedExtensionsModified(TestAllExtensions message) { expect(message.getExtension(Unittest.repeatedCordExtension).length, 2); expect(message.getExtension(Unittest.repeatedInt32Extension)[0], 201); - expect(message.getExtension(Unittest.repeatedInt64Extension)[0], - expect64(202)); + expect( + message.getExtension(Unittest.repeatedInt64Extension)[0], expect64(202)); expect(message.getExtension(Unittest.repeatedUint32Extension)[0], 203); - expect(message.getExtension(Unittest.repeatedUint64Extension)[0], - expect64(204)); + expect( + message.getExtension(Unittest.repeatedUint64Extension)[0], expect64(204)); expect(message.getExtension(Unittest.repeatedSint32Extension)[0], 205); - expect(message.getExtension(Unittest.repeatedSint64Extension)[0], - expect64(206)); + expect( + message.getExtension(Unittest.repeatedSint64Extension)[0], expect64(206)); expect(message.getExtension(Unittest.repeatedFixed32Extension)[0], 207); expect(message.getExtension(Unittest.repeatedFixed64Extension)[0], - expect64(208)); + expect64(208)); expect(message.getExtension(Unittest.repeatedSfixed32Extension)[0], 209); expect(message.getExtension(Unittest.repeatedSfixed64Extension)[0], - expect64(210)); + expect64(210)); expect(message.getExtension(Unittest.repeatedFloatExtension)[0], 211.0); expect(message.getExtension(Unittest.repeatedDoubleExtension)[0], 212.0); expect(message.getExtension(Unittest.repeatedBoolExtension)[0], true); expect(message.getExtension(Unittest.repeatedStringExtension)[0], '215'); expect(message.getExtension(Unittest.repeatedBytesExtension)[0], - '216'.codeUnits); + '216'.codeUnits); expect(message.getExtension(Unittest.repeatedGroupExtension)[0].a, 217); - expect(message.getExtension(Unittest.repeatedNestedMessageExtension)[0].bb, - 218); - expect(message.getExtension(Unittest.repeatedForeignMessageExtension)[0].c, - 219); - expect(message.getExtension(Unittest.repeatedImportMessageExtension)[0].d, - 220); + expect( + message.getExtension(Unittest.repeatedNestedMessageExtension)[0].bb, 218); + expect( + message.getExtension(Unittest.repeatedForeignMessageExtension)[0].c, 219); + expect( + message.getExtension(Unittest.repeatedImportMessageExtension)[0].d, 220); expect(message.getExtension(Unittest.repeatedNestedEnumExtension)[0], - TestAllTypes_NestedEnum.BAR); + TestAllTypes_NestedEnum.BAR); expect(message.getExtension(Unittest.repeatedForeignEnumExtension)[0], - ForeignEnum.FOREIGN_BAR); + ForeignEnum.FOREIGN_BAR); expect(message.getExtension(Unittest.repeatedImportEnumExtension)[0], - ImportEnum.IMPORT_BAR); + ImportEnum.IMPORT_BAR); expect(message.getExtension(Unittest.repeatedStringPieceExtension)[0], '224'); expect(message.getExtension(Unittest.repeatedCordExtension)[0], '225'); expect(message.getExtension(Unittest.repeatedInt32Extension)[1], 501); - expect(message.getExtension(Unittest.repeatedInt64Extension)[1], - expect64(502)); + expect( + message.getExtension(Unittest.repeatedInt64Extension)[1], expect64(502)); expect(message.getExtension(Unittest.repeatedUint32Extension)[1], 503); - expect(message.getExtension(Unittest.repeatedUint64Extension)[1], - expect64(504)); + expect( + message.getExtension(Unittest.repeatedUint64Extension)[1], expect64(504)); expect(message.getExtension(Unittest.repeatedSint32Extension)[1], 505); - expect(message.getExtension(Unittest.repeatedSint64Extension)[1], - expect64(506)); + expect( + message.getExtension(Unittest.repeatedSint64Extension)[1], expect64(506)); expect(message.getExtension(Unittest.repeatedFixed32Extension)[1], 507); expect(message.getExtension(Unittest.repeatedFixed64Extension)[1], - expect64(508)); + expect64(508)); expect(message.getExtension(Unittest.repeatedSfixed32Extension)[1], 509); expect(message.getExtension(Unittest.repeatedSfixed64Extension)[1], - expect64(510)); + expect64(510)); expect(message.getExtension(Unittest.repeatedFloatExtension)[1], 511.0); expect(message.getExtension(Unittest.repeatedDoubleExtension)[1], 512.0); expect(message.getExtension(Unittest.repeatedBoolExtension)[1], true); expect(message.getExtension(Unittest.repeatedStringExtension)[1], '515'); expect(message.getExtension(Unittest.repeatedBytesExtension)[1], - '516'.codeUnits); + '516'.codeUnits); expect(message.getExtension(Unittest.repeatedGroupExtension)[1].a, 517); - expect(message.getExtension(Unittest.repeatedNestedMessageExtension)[1].bb, - 518); - expect(message.getExtension(Unittest.repeatedForeignMessageExtension)[1].c, - 519); - expect(message.getExtension(Unittest.repeatedImportMessageExtension)[1].d, - 520); + expect( + message.getExtension(Unittest.repeatedNestedMessageExtension)[1].bb, 518); + expect( + message.getExtension(Unittest.repeatedForeignMessageExtension)[1].c, 519); + expect( + message.getExtension(Unittest.repeatedImportMessageExtension)[1].d, 520); expect(message.getExtension(Unittest.repeatedNestedEnumExtension)[1], - TestAllTypes_NestedEnum.FOO); + TestAllTypes_NestedEnum.FOO); expect(message.getExtension(Unittest.repeatedForeignEnumExtension)[1], - ForeignEnum.FOREIGN_FOO); + ForeignEnum.FOREIGN_FOO); expect(message.getExtension(Unittest.repeatedImportEnumExtension)[1], - ImportEnum.IMPORT_FOO); + ImportEnum.IMPORT_FOO); expect(message.getExtension(Unittest.repeatedStringPieceExtension)[1], '524'); expect(message.getExtension(Unittest.repeatedCordExtension)[1], '525'); @@ -1114,20 +1103,16 @@ void assertRepeatedExtensionsModified(TestAllExtensions message) { expect(message.hasExtension(Unittest.defaultCordExtension), isTrue); expect(message.getExtension(Unittest.defaultInt32Extension), 401); - expect(message.getExtension(Unittest.defaultInt64Extension), - expect64(402)); + expect(message.getExtension(Unittest.defaultInt64Extension), expect64(402)); expect(message.getExtension(Unittest.defaultUint32Extension), 403); - expect(message.getExtension(Unittest.defaultUint64Extension), - expect64(404)); + expect(message.getExtension(Unittest.defaultUint64Extension), expect64(404)); expect(message.getExtension(Unittest.defaultSint32Extension), 405); - expect(message.getExtension(Unittest.defaultSint64Extension), - expect64(406)); + expect(message.getExtension(Unittest.defaultSint64Extension), expect64(406)); expect(message.getExtension(Unittest.defaultFixed32Extension), 407); - expect(message.getExtension(Unittest.defaultFixed64Extension), - expect64(408)); + expect(message.getExtension(Unittest.defaultFixed64Extension), expect64(408)); expect(message.getExtension(Unittest.defaultSfixed32Extension), 409); - expect(message.getExtension(Unittest.defaultSfixed64Extension), - expect64(410)); + expect( + message.getExtension(Unittest.defaultSfixed64Extension), expect64(410)); expect(message.getExtension(Unittest.defaultFloatExtension), 411.0); expect(message.getExtension(Unittest.defaultDoubleExtension), 412.0); expect(message.getExtension(Unittest.defaultBoolExtension), false); @@ -1135,11 +1120,11 @@ void assertRepeatedExtensionsModified(TestAllExtensions message) { expect(message.getExtension(Unittest.defaultBytesExtension), '416'.codeUnits); expect(message.getExtension(Unittest.defaultNestedEnumExtension), - TestAllTypes_NestedEnum.FOO); + TestAllTypes_NestedEnum.FOO); expect(message.getExtension(Unittest.defaultForeignEnumExtension), - ForeignEnum.FOREIGN_FOO); + ForeignEnum.FOREIGN_FOO); expect(message.getExtension(Unittest.defaultImportEnumExtension), - ImportEnum.IMPORT_FOO); + ImportEnum.IMPORT_FOO); expect(message.getExtension(Unittest.defaultStringPieceExtension), '424'); expect(message.getExtension(Unittest.defaultCordExtension), '425'); @@ -1302,7 +1287,7 @@ TestAllTypes getAllSet() { ExtensionRegistry getExtensionRegistry() { ExtensionRegistry registry = new ExtensionRegistry(); registerAllExtensions(registry); - return registry/*.getUnmodifiable()*/; + return registry /*.getUnmodifiable()*/; } TestPackedExtensions getPackedExtensionsSet() { @@ -1390,9 +1375,7 @@ void modifyRepeatedFields(TestAllTypes message) { message.repeatedString[1] = '515'; message.repeatedBytes[1] = '516'.codeUnits; - - TestAllTypes_RepeatedGroup repeatedGroup = - new TestAllTypes_RepeatedGroup(); + TestAllTypes_RepeatedGroup repeatedGroup = new TestAllTypes_RepeatedGroup(); repeatedGroup.a = 517; message.repeatedGroup[1] = repeatedGroup; @@ -1401,13 +1384,11 @@ void modifyRepeatedFields(TestAllTypes message) { optionalNestedMessage.bb = 518; message.repeatedNestedMessage[1] = optionalNestedMessage; - ForeignMessage optionalForeignMessage = - new ForeignMessage(); + ForeignMessage optionalForeignMessage = new ForeignMessage(); optionalForeignMessage.c = 519; message.repeatedForeignMessage[1] = optionalForeignMessage; - ImportMessage optionalImportMessage = - new ImportMessage(); + ImportMessage optionalImportMessage = new ImportMessage(); optionalImportMessage.d = 520; message.repeatedImportMessage[1] = optionalImportMessage; @@ -1438,8 +1419,7 @@ void setAllExtensions(TestAllExtensions message) { message.setExtension(Unittest.optionalDoubleExtension, 112.0); message.setExtension(Unittest.optionalBoolExtension, true); message.setExtension(Unittest.optionalStringExtension, '115'); - message.setExtension(Unittest.optionalBytesExtension, - '116'.codeUnits); + message.setExtension(Unittest.optionalBytesExtension, '116'.codeUnits); var msg; @@ -1459,12 +1439,12 @@ void setAllExtensions(TestAllExtensions message) { msg.d = 120; message.setExtension(Unittest.optionalImportMessageExtension, msg); - message.setExtension(Unittest.optionalNestedEnumExtension, - TestAllTypes_NestedEnum.BAZ); - message.setExtension(Unittest.optionalForeignEnumExtension, - ForeignEnum.FOREIGN_BAZ); - message.setExtension(Unittest.optionalImportEnumExtension, - ImportEnum.IMPORT_BAZ); + message.setExtension( + Unittest.optionalNestedEnumExtension, TestAllTypes_NestedEnum.BAZ); + message.setExtension( + Unittest.optionalForeignEnumExtension, ForeignEnum.FOREIGN_BAZ); + message.setExtension( + Unittest.optionalImportEnumExtension, ImportEnum.IMPORT_BAZ); message.setExtension(Unittest.optionalStringPieceExtension, '124'); message.setExtension(Unittest.optionalCordExtension, '125'); @@ -1503,15 +1483,14 @@ void setAllExtensions(TestAllExtensions message) { msg.d = 220; message.addExtension(Unittest.repeatedImportMessageExtension, msg); - message.addExtension(Unittest.repeatedNestedEnumExtension, - TestAllTypes_NestedEnum.BAR); - message.addExtension(Unittest.repeatedForeignEnumExtension, - ForeignEnum.FOREIGN_BAR); - message.addExtension(Unittest.repeatedImportEnumExtension, - ImportEnum.IMPORT_BAR); + message.addExtension( + Unittest.repeatedNestedEnumExtension, TestAllTypes_NestedEnum.BAR); + message.addExtension( + Unittest.repeatedForeignEnumExtension, ForeignEnum.FOREIGN_BAR); + message.addExtension( + Unittest.repeatedImportEnumExtension, ImportEnum.IMPORT_BAR); - message.addExtension(Unittest.repeatedStringPieceExtension, - '224'); + message.addExtension(Unittest.repeatedStringPieceExtension, '224'); message.addExtension(Unittest.repeatedCordExtension, '225'); // Add a second one of each field. @@ -1529,8 +1508,7 @@ void setAllExtensions(TestAllExtensions message) { message.addExtension(Unittest.repeatedDoubleExtension, 312.0); message.addExtension(Unittest.repeatedBoolExtension, false); message.addExtension(Unittest.repeatedStringExtension, '315'); - message.addExtension(Unittest.repeatedBytesExtension, - '316'.codeUnits); + message.addExtension(Unittest.repeatedBytesExtension, '316'.codeUnits); msg = new RepeatedGroup_extension(); msg.a = 317; @@ -1548,12 +1526,12 @@ void setAllExtensions(TestAllExtensions message) { msg.d = 320; message.addExtension(Unittest.repeatedImportMessageExtension, msg); - message.addExtension(Unittest.repeatedNestedEnumExtension, - TestAllTypes_NestedEnum.BAZ); - message.addExtension(Unittest.repeatedForeignEnumExtension, - ForeignEnum.FOREIGN_BAZ); - message.addExtension(Unittest.repeatedImportEnumExtension, - ImportEnum.IMPORT_BAZ); + message.addExtension( + Unittest.repeatedNestedEnumExtension, TestAllTypes_NestedEnum.BAZ); + message.addExtension( + Unittest.repeatedForeignEnumExtension, ForeignEnum.FOREIGN_BAZ); + message.addExtension( + Unittest.repeatedImportEnumExtension, ImportEnum.IMPORT_BAZ); message.addExtension(Unittest.repeatedStringPieceExtension, '324'); message.addExtension(Unittest.repeatedCordExtension, '325'); @@ -1576,12 +1554,12 @@ void setAllExtensions(TestAllExtensions message) { message.setExtension(Unittest.defaultStringExtension, '415'); message.setExtension(Unittest.defaultBytesExtension, '416'.codeUnits); - message.setExtension(Unittest.defaultNestedEnumExtension, - TestAllTypes_NestedEnum.FOO); - message.setExtension(Unittest.defaultForeignEnumExtension, - ForeignEnum.FOREIGN_FOO); - message.setExtension(Unittest.defaultImportEnumExtension, - ImportEnum.IMPORT_FOO); + message.setExtension( + Unittest.defaultNestedEnumExtension, TestAllTypes_NestedEnum.FOO); + message.setExtension( + Unittest.defaultForeignEnumExtension, ForeignEnum.FOREIGN_FOO); + message.setExtension( + Unittest.defaultImportEnumExtension, ImportEnum.IMPORT_FOO); message.setExtension(Unittest.defaultStringPieceExtension, '424'); message.setExtension(Unittest.defaultCordExtension, '425'); @@ -1608,8 +1586,7 @@ void setAllFields(TestAllTypes message) { message.optionalString = '115'; message.optionalBytes = '116'.codeUnits; - TestAllTypes_OptionalGroup optionalGroup = - new TestAllTypes_OptionalGroup(); + TestAllTypes_OptionalGroup optionalGroup = new TestAllTypes_OptionalGroup(); optionalGroup.a = 117; message.optionalGroup = optionalGroup; @@ -1618,8 +1595,7 @@ void setAllFields(TestAllTypes message) { optionalNestedMessage.bb = 118; message.optionalNestedMessage = optionalNestedMessage; - ForeignMessage optionalForeignMessage = - new ForeignMessage(); + ForeignMessage optionalForeignMessage = new ForeignMessage(); optionalForeignMessage.c = 119; message.optionalForeignMessage = optionalForeignMessage; @@ -1652,18 +1628,15 @@ void setAllFields(TestAllTypes message) { message.repeatedString.add('215'); message.repeatedBytes.add('216'.codeUnits); - TestAllTypes_RepeatedGroup repeatedGroup = - new TestAllTypes_RepeatedGroup(); + TestAllTypes_RepeatedGroup repeatedGroup = new TestAllTypes_RepeatedGroup(); repeatedGroup.a = 217; message.repeatedGroup.add(repeatedGroup); - TestAllTypes_NestedMessage repeatedNested = - new TestAllTypes_NestedMessage(); + TestAllTypes_NestedMessage repeatedNested = new TestAllTypes_NestedMessage(); repeatedNested.bb = 218; message.repeatedNestedMessage.add(repeatedNested); - ForeignMessage repeatedForeignMessage = - new ForeignMessage(); + ForeignMessage repeatedForeignMessage = new ForeignMessage(); repeatedForeignMessage.c = 219; message.repeatedForeignMessage.add(repeatedForeignMessage); @@ -1758,8 +1731,7 @@ void setPackedExtensions(TestPackedExtensions message) { message.addExtension(Unittest.packedFloatExtension, 611.0); message.addExtension(Unittest.packedDoubleExtension, 612.0); message.addExtension(Unittest.packedBoolExtension, true); - message.addExtension(Unittest.packedEnumExtension, - ForeignEnum.FOREIGN_BAR); + message.addExtension(Unittest.packedEnumExtension, ForeignEnum.FOREIGN_BAR); // Add a second one of each field. message.addExtension(Unittest.packedInt32Extension, 701); message.addExtension(Unittest.packedInt64Extension, make64(702)); @@ -1774,8 +1746,7 @@ void setPackedExtensions(TestPackedExtensions message) { message.addExtension(Unittest.packedFloatExtension, 711.0); message.addExtension(Unittest.packedDoubleExtension, 712.0); message.addExtension(Unittest.packedBoolExtension, false); - message.addExtension(Unittest.packedEnumExtension, - ForeignEnum.FOREIGN_BAZ); + message.addExtension(Unittest.packedEnumExtension, ForeignEnum.FOREIGN_BAZ); } /** diff --git a/test/unknown_field_set_test.dart b/test/unknown_field_set_test.dart index dfb5bae63..b0305a4e7 100755 --- a/test/unknown_field_set_test.dart +++ b/test/unknown_field_set_test.dart @@ -16,7 +16,7 @@ void main() { TestAllTypes testAllTypes = getAllSet(); List allFieldsData = testAllTypes.writeToBuffer(); TestEmptyMessage emptyMessage = - new TestEmptyMessage.fromBuffer(allFieldsData); + new TestEmptyMessage.fromBuffer(allFieldsData); UnknownFieldSet unknownFields = emptyMessage.unknownFields; UnknownFieldSetField getField(String name) { @@ -38,10 +38,9 @@ void main() { expect(s1 == s2, isFalse); expect(s2 == s1, isFalse); - expect( - s1.hashCode == s2.hashCode, isFalse, reason: - '${s1.toString()} should have a different hash code ' - 'from ${s2.toString()}'); + expect(s1.hashCode == s2.hashCode, isFalse, + reason: '${s1.toString()} should have a different hash code ' + 'from ${s2.toString()}'); } /** @@ -86,7 +85,7 @@ void main() { UnknownFieldSet group = optionalGroupField.groups[0]; expect(group.hasField(tagNumberA), isTrue); expect(group.getField(tagNumberA).varints[0], - expect64(testAllTypes.optionalGroup.a)); + expect64(testAllTypes.optionalGroup.a)); }); test('testSerialize', () { @@ -102,26 +101,27 @@ void main() { test('testMergeFrom', () { // Source. UnknownFieldSet sourceFieldSet = new UnknownFieldSet() - ..addField(2, new UnknownFieldSetField()..addVarint(make64(2))) - ..addField(3, new UnknownFieldSetField()..addVarint(make64(3))); + ..addField(2, new UnknownFieldSetField()..addVarint(make64(2))) + ..addField(3, new UnknownFieldSetField()..addVarint(make64(3))); TestEmptyMessage source = new TestEmptyMessage() - ..mergeUnknownFields(sourceFieldSet); + ..mergeUnknownFields(sourceFieldSet); // Destination. UnknownFieldSet destinationFieldSet = new UnknownFieldSet() - ..addField(1, new UnknownFieldSetField()..addVarint(make64(1))) - ..addField(3, new UnknownFieldSetField()..addVarint(make64(4))); + ..addField(1, new UnknownFieldSetField()..addVarint(make64(1))) + ..addField(3, new UnknownFieldSetField()..addVarint(make64(4))); TestEmptyMessage destination = new TestEmptyMessage() - ..mergeUnknownFields(destinationFieldSet) - ..mergeFromMessage(source); - - expect(destination.toString(), - '1: 1\n' - '2: 2\n' - '3: 4\n' - '3: 3\n'); + ..mergeUnknownFields(destinationFieldSet) + ..mergeFromMessage(source); + + expect( + destination.toString(), + '1: 1\n' + '2: 2\n' + '3: 4\n' + '3: 3\n'); }); test('testClear', () { @@ -142,8 +142,7 @@ void main() { test('testParseKnownAndUnknown', () { // Test mixing known and unknown fields when parsing. UnknownFieldSet fields = unknownFields.clone() - ..addField(123456, - new UnknownFieldSetField()..addVarint(make64(654321))); + ..addField(123456, new UnknownFieldSetField()..addVarint(make64(654321))); CodedBufferWriter writer = new CodedBufferWriter(); fields.writeToCodedBufferWriter(writer); @@ -165,10 +164,10 @@ void main() { UnknownFieldSet bizarroFields = new UnknownFieldSet(); UnknownFieldSetField varintField = new UnknownFieldSetField() - ..addVarint(make64(1)); + ..addVarint(make64(1)); UnknownFieldSetField fixed32Field = new UnknownFieldSetField() - ..addFixed32(1); + ..addFixed32(1); unknownFields.asMap().forEach((int tag, UnknownFieldSetField value) { if (value.varints.isEmpty) { @@ -228,10 +227,14 @@ void main() { expect(repeatedFieldNum, isNotNull); UnknownFieldSet fieldSet = new UnknownFieldSet() - ..addField(singularFieldNum, new UnknownFieldSetField() + ..addField( + singularFieldNum, + new UnknownFieldSetField() ..addVarint(make64(TestAllTypes_NestedEnum.BAR.value)) ..addVarint(make64(5))) - ..addField(repeatedFieldNum, new UnknownFieldSetField() + ..addField( + repeatedFieldNum, + new UnknownFieldSetField() ..addVarint(make64(TestAllTypes_NestedEnum.FOO.value)) ..addVarint(make64(4)) ..addVarint(make64(TestAllTypes_NestedEnum.BAZ.value)) @@ -243,7 +246,7 @@ void main() { TestAllTypes message = new TestAllTypes.fromBuffer(writer.toBuffer()); expect(message.optionalNestedEnum, TestAllTypes_NestedEnum.BAR); expect(message.repeatedNestedEnum, - [TestAllTypes_NestedEnum.FOO, TestAllTypes_NestedEnum.BAZ]); + [TestAllTypes_NestedEnum.FOO, TestAllTypes_NestedEnum.BAZ]); final singularVarints = message.unknownFields.getField(singularFieldNum).varints; expect(singularVarints.length, 1); @@ -258,10 +261,10 @@ void main() { TestAllExtensions message = new TestAllExtensions.fromBuffer( writer.toBuffer(), getExtensionRegistry()); expect(message.getExtension(Unittest.optionalNestedEnumExtension), - TestAllTypes_NestedEnum.BAR); + TestAllTypes_NestedEnum.BAR); expect(message.getExtension(Unittest.repeatedNestedEnumExtension), - [TestAllTypes_NestedEnum.FOO, TestAllTypes_NestedEnum.BAZ]); + [TestAllTypes_NestedEnum.FOO, TestAllTypes_NestedEnum.BAZ]); final singularVarints = message.unknownFields.getField(singularFieldNum).varints; expect(singularVarints.length, 1); @@ -276,34 +279,35 @@ void main() { test('testLargeVarint', () { UnknownFieldSet unknownFieldSet = new UnknownFieldSet() - ..addField(1, new UnknownFieldSetField() + ..addField( + 1, + new UnknownFieldSetField() ..addVarint(make64(0x7FFFFFFF, 0xFFFFFFFF))); CodedBufferWriter writer = new CodedBufferWriter(); unknownFieldSet.writeToCodedBufferWriter(writer); var parsed = new UnknownFieldSet() - ..mergeFromCodedBufferReader(new CodedBufferReader(writer.toBuffer())); + ..mergeFromCodedBufferReader(new CodedBufferReader(writer.toBuffer())); var field = parsed.getField(1); expect(field.varints.length, 1); - expect(field.varints[0], - expect64(0x7FFFFFFF, 0xFFFFFFFFF)); + expect(field.varints[0], expect64(0x7FFFFFFF, 0xFFFFFFFFF)); }); test('testEquals', () { UnknownFieldSet a = new UnknownFieldSet() - ..addField(1, new UnknownFieldSetField()..addFixed32(1)); + ..addField(1, new UnknownFieldSetField()..addFixed32(1)); UnknownFieldSet b = new UnknownFieldSet() - ..addField(1, new UnknownFieldSetField()..addFixed64(make64(1))); + ..addField(1, new UnknownFieldSetField()..addFixed64(make64(1))); UnknownFieldSet c = new UnknownFieldSet() - ..addField(1, new UnknownFieldSetField()..addVarint(make64(1))); + ..addField(1, new UnknownFieldSetField()..addVarint(make64(1))); UnknownFieldSet d = new UnknownFieldSet() - ..addField(1, new UnknownFieldSetField()..addLengthDelimited([])); + ..addField(1, new UnknownFieldSetField()..addLengthDelimited([])); UnknownFieldSet e = new UnknownFieldSet() - ..addField(1, new UnknownFieldSetField()..addGroup(unknownFields)); + ..addField(1, new UnknownFieldSetField()..addGroup(unknownFields)); _checkEqualsIsConsistent(a); _checkEqualsIsConsistent(b); @@ -323,9 +327,9 @@ void main() { _checkNotEqual(d, e); UnknownFieldSet f1 = new UnknownFieldSet() - ..addField(1, new UnknownFieldSetField()..addLengthDelimited([1, 2])); + ..addField(1, new UnknownFieldSetField()..addLengthDelimited([1, 2])); UnknownFieldSet f2 = new UnknownFieldSet() - ..addField(1, new UnknownFieldSetField()..addLengthDelimited([2, 1])); + ..addField(1, new UnknownFieldSetField()..addLengthDelimited([2, 1])); _checkEqualsIsConsistent(f1); _checkEqualsIsConsistent(f2); diff --git a/test/wire_format_test.dart b/test/wire_format_test.dart index 65895e3bd..f4530e3b9 100755 --- a/test/wire_format_test.dart +++ b/test/wire_format_test.dart @@ -30,7 +30,7 @@ void main() { test('testSerializePackedExtensions', () { expect(getPackedExtensionsSet().writeToBuffer(), - getPackedSet().writeToBuffer()); + getPackedSet().writeToBuffer()); }); test('testParseExtensions', () { @@ -61,15 +61,15 @@ void main() { // Make sure we can parse a message that contains multiple extensions // ranges. TestFieldOrderings source = new TestFieldOrderings() - ..myInt = make64(1) - ..myString = 'foo' - ..myFloat = 1.0 - ..setExtension(Unittest.myExtensionInt, 23) - ..setExtension(Unittest.myExtensionString, 'bar'); + ..myInt = make64(1) + ..myString = 'foo' + ..myFloat = 1.0 + ..setExtension(Unittest.myExtensionInt, 23) + ..setExtension(Unittest.myExtensionString, 'bar'); ExtensionRegistry registry = new ExtensionRegistry() - ..add(Unittest.myExtensionInt) - ..add(Unittest.myExtensionString); + ..add(Unittest.myExtensionInt) + ..add(Unittest.myExtensionString); TestFieldOrderings dest = new TestFieldOrderings.fromBuffer(source.writeToBuffer(), registry);