Skip to content

Commit

Permalink
Fix a test: (google#795)
Browse files Browse the repository at this point in the history
This test is currently using an invalid map key type (int instead of
string) for indexing and comparing two `null` values. It was valid in
older versions where maps were represented as lists, but became invalid
when we switched to a map type.

Also updated the length check to rule out the case where lists have the
same length, but both are wrong.

Syncs cl/504248137 with some changes.
  • Loading branch information
osa1 authored Jan 31, 2023
1 parent cc0f287 commit e37628e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions protoc_plugin/test/extension_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,9 @@ void main() {
isTrue);
expect(
identical(withUnknownFields.innerMap[1], reparsed.innerMap[1]), isTrue);
expect(withUnknownFields.stringMap.length, reparsed.stringMap.length);
expect(withUnknownFields.stringMap[0], reparsed.stringMap[0]);
expect(withUnknownFields.stringMap.length, 1);
expect(reparsed.stringMap.length, 1);
expect(withUnknownFields.stringMap['hello']!, reparsed.stringMap['hello']!);
});

test('consistent hashcode for reparsed messages with extensions', () {
Expand Down

0 comments on commit e37628e

Please sign in to comment.