Skip to content

Commit a15fde0

Browse files
author
Anna Gringauze
authored
fix matching record types (#2032)
* fix matching record types * Temporarily disable failing webdev tests * Enable fixed tests
1 parent 05031da commit a15fde0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

dwds/test/instances/instance_inspection_common.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,16 @@ Matcher matchRecordInstance({required int length, required String type}) =>
162162
isA<Instance>()
163163
.having((e) => e.kind, 'kind', InstanceKind.kRecord)
164164
.having((e) => e.length, 'length', length)
165-
.having((e) => e.classRef!.name, 'classRef.name', type);
165+
.having((e) => e.classRef!, 'classRef', matchRecordType(type));
166+
167+
/// Currently some dart versions allow for the record type
168+
/// to show as `RecordType(type1, type2...)`, and some as `(type1, type2...)`.
169+
/// Match both versions.
170+
///
171+
/// TODO(annagrin): Replace by matching `(type1, type2...)` after dart 3.0
172+
/// is stable.
173+
Matcher matchRecordType(String type) => isA<ClassRef>().having((e) => e.name,
174+
'type name', anyOf([type.replaceAll('RecordType', ''), type]));
166175

167176
Object? _getValue(InstanceRef instanceRef) {
168177
switch (instanceRef.kind) {

dwds/test/instances/record_inspection_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,5 +394,5 @@ Future<void> _runTests({
394394
expect(await getFields(instanceRef, offset: 0), {1: false, 2: 5});
395395
});
396396
});
397-
}, skip: 'https://github.com/dart-lang/webdev/issues/2033');
397+
});
398398
}

0 commit comments

Comments
 (0)