From a5ad75325bd0f96dca85bd3761585570441ad40c Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 22 Jan 2024 09:15:06 -0800 Subject: [PATCH] Skip record type inspection tests (#2352) --- .../common/record_type_inspection_common.dart | 330 ++++++++++-------- .../test/instances/common/test_inspector.dart | 21 +- .../common/type_inspection_common.dart | 57 +-- 3 files changed, 238 insertions(+), 170 deletions(-) diff --git a/dwds/test/instances/common/record_type_inspection_common.dart b/dwds/test/instances/common/record_type_inspection_common.dart index 9e5eb9189..1d41bdbff 100644 --- a/dwds/test/instances/common/record_type_inspection_common.dart +++ b/dwds/test/instances/common/record_type_inspection_common.dart @@ -78,19 +78,30 @@ void runTests({ setUp(() => setCurrentLogWriter(debug: debug)); tearDown(() => service.resume(isolateId)); - test('simple record type', () async { - await onBreakPoint('printSimpleLocalRecord', (event) async { - final frame = event.topFrame!.index!; - final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); - final instanceId = instanceRef.id!; - - expect(instanceRef, matchRecordTypeInstanceRef(length: 2)); - expect(await getObject(instanceId), matchRecordTypeInstance(length: 2)); - - final classId = instanceRef.classRef!.id; - expect(await getObject(classId), matchRecordTypeClass); - }); - }); + test( + 'simple record type', + () async { + await onBreakPoint( + 'printSimpleLocalRecord', + (event) async { + final frame = event.topFrame!.index!; + final instanceRef = + await getInstanceRef(frame, 'record.runtimeType'); + final instanceId = instanceRef.id!; + + expect(instanceRef, matchRecordTypeInstanceRef(length: 2)); + expect( + await getObject(instanceId), + matchRecordTypeInstance(length: 2), + ); + + final classId = instanceRef.classRef!.id; + expect(await getObject(classId), matchRecordTypeClass); + }, + ); + }, + skip: 'https://github.com/dart-lang/webdev/issues/2351', + ); test('simple record type elements', () async { await onBreakPoint('printSimpleLocalRecord', (event) async { @@ -126,19 +137,26 @@ void runTests({ }); }); - test('complex record type', () async { - await onBreakPoint('printComplexLocalRecord', (event) async { - final frame = event.topFrame!.index!; - final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); - final instanceId = instanceRef.id!; - - expect(instanceRef, matchRecordTypeInstanceRef(length: 3)); - expect(await getObject(instanceId), matchRecordTypeInstance(length: 3)); - - final classId = instanceRef.classRef!.id; - expect(await getObject(classId), matchRecordTypeClass); - }); - }); + test( + 'complex record type', + () async { + await onBreakPoint('printComplexLocalRecord', (event) async { + final frame = event.topFrame!.index!; + final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); + final instanceId = instanceRef.id!; + + expect(instanceRef, matchRecordTypeInstanceRef(length: 3)); + expect( + await getObject(instanceId), + matchRecordTypeInstance(length: 3), + ); + + final classId = instanceRef.classRef!.id; + expect(await getObject(classId), matchRecordTypeClass); + }); + }, + skip: 'https://github.com/dart-lang/webdev/issues/2351', + ); test('complex record type elements', () async { await onBreakPoint('printComplexLocalRecord', (event) async { @@ -178,19 +196,26 @@ void runTests({ }); }); - test('complex record type with named fields ', () async { - await onBreakPoint('printComplexNamedLocalRecord', (event) async { - final frame = event.topFrame!.index!; - final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); - final instanceId = instanceRef.id!; - - expect(instanceRef, matchRecordTypeInstanceRef(length: 3)); - expect(await getObject(instanceId), matchRecordTypeInstance(length: 3)); - - final classId = instanceRef.classRef!.id; - expect(await getObject(classId), matchRecordTypeClass); - }); - }); + test( + 'complex record type with named fields ', + () async { + await onBreakPoint('printComplexNamedLocalRecord', (event) async { + final frame = event.topFrame!.index!; + final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); + final instanceId = instanceRef.id!; + + expect(instanceRef, matchRecordTypeInstanceRef(length: 3)); + expect( + await getObject(instanceId), + matchRecordTypeInstance(length: 3), + ); + + final classId = instanceRef.classRef!.id; + expect(await getObject(classId), matchRecordTypeClass); + }); + }, + skip: 'https://github.com/dart-lang/webdev/issues/2351', + ); test('complex record type with named fields elements', () async { await onBreakPoint('printComplexNamedLocalRecord', (event) async { @@ -231,45 +256,56 @@ void runTests({ }); }); - test('nested record type', () async { - await onBreakPoint('printNestedLocalRecord', (event) async { - final frame = event.topFrame!.index!; - final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); - final instanceId = instanceRef.id!; - - expect(instanceRef, matchRecordTypeInstanceRef(length: 2)); - expect(await getObject(instanceId), matchRecordTypeInstance(length: 2)); - - final classId = instanceRef.classRef!.id; - expect(await getObject(classId), matchRecordTypeClass); - }); - }); - - test('nested record type elements', () async { - await onBreakPoint('printNestedLocalRecord', (event) async { - final frame = event.topFrame!.index!; - final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); - final instanceId = instanceRef.id!; - - final elements = await getElements(instanceId); - expect( - elements, - [matchTypeInstance('bool'), matchRecordTypeInstance(length: 2)], - ); - expect( - await getElements(elements[1].id!), - [matchTypeInstance('bool'), matchTypeInstance('int')], - ); - expect( - await getDisplayedFields(instanceRef), - ['bool', '(bool, int)'], - ); - expect( - await getDisplayedFields(elements[1]), - ['bool', 'int'], - ); - }); - }); + test( + 'nested record type', + () async { + await onBreakPoint('printNestedLocalRecord', (event) async { + final frame = event.topFrame!.index!; + final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); + final instanceId = instanceRef.id!; + + expect(instanceRef, matchRecordTypeInstanceRef(length: 2)); + expect( + await getObject(instanceId), + matchRecordTypeInstance(length: 2), + ); + + final classId = instanceRef.classRef!.id; + expect(await getObject(classId), matchRecordTypeClass); + }); + }, + skip: 'https://github.com/dart-lang/webdev/issues/2351', + ); + + test( + 'nested record type elements', + () async { + await onBreakPoint('printNestedLocalRecord', (event) async { + final frame = event.topFrame!.index!; + final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); + final instanceId = instanceRef.id!; + + final elements = await getElements(instanceId); + expect( + elements, + [matchTypeInstance('bool'), matchRecordTypeInstance(length: 2)], + ); + expect( + await getElements(elements[1].id!), + [matchTypeInstance('bool'), matchTypeInstance('int')], + ); + expect( + await getDisplayedFields(instanceRef), + ['bool', '(bool, int)'], + ); + expect( + await getDisplayedFields(elements[1]), + ['bool', 'int'], + ); + }); + }, + skip: 'https://github.com/dart-lang/webdev/issues/2351', + ); test('nested record type display', () async { await onBreakPoint('printNestedLocalRecord', (event) async { @@ -288,68 +324,80 @@ void runTests({ }); }); - test('nested record type with named fields', () async { - await onBreakPoint('printNestedNamedLocalRecord', (event) async { - final frame = event.topFrame!.index!; - final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); - final instanceId = instanceRef.id!; - final instance = await getObject(instanceId); - - expect(instanceRef, matchRecordTypeInstanceRef(length: 2)); - expect(instance, matchRecordTypeInstance(length: 2)); - - final classId = instanceRef.classRef!.id; - expect(await getObject(classId), matchRecordTypeClass); - }); - }); - - test('nested record type with named fields elements', () async { - await onBreakPoint('printNestedNamedLocalRecord', (event) async { - final frame = event.topFrame!.index!; - final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); - final instanceId = instanceRef.id!; - - final elements = await getElements(instanceId); - expect( - elements, - [matchTypeInstance('bool'), matchRecordTypeInstance(length: 2)], - ); - expect( - await getElements(elements[1].id!), - [matchTypeInstance('bool'), matchTypeInstance('int')], - ); - expect( - await getDisplayedFields(instanceRef), - ['bool', '(bool, int)'], - ); - expect( - await getDisplayedFields(elements[1]), - ['bool', 'int'], - ); - }); - }); - - test('nested record type with named fields display', () async { - await onBreakPoint('printNestedNamedLocalRecord', (event) async { - final frame = event.topFrame!.index!; - final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); - final instance = await getObject(instanceRef.id!); - final typeClassId = instance.classRef!.id; - - expect(await getObject(typeClassId), matchRecordTypeClass); - - final typeStringRef = - await getInstanceRef(frame, 'record.runtimeType.toString()'); - final typeStringId = typeStringRef.id!; - - expect( - await getObject(typeStringId), - matchPrimitiveInstance( - kind: InstanceKind.kString, - value: '(bool, {(bool, int) inner})', - ), - ); - }); - }); + test( + 'nested record type with named fields', + () async { + await onBreakPoint('printNestedNamedLocalRecord', (event) async { + final frame = event.topFrame!.index!; + final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); + final instanceId = instanceRef.id!; + final instance = await getObject(instanceId); + + expect(instanceRef, matchRecordTypeInstanceRef(length: 2)); + expect(instance, matchRecordTypeInstance(length: 2)); + + final classId = instanceRef.classRef!.id; + expect(await getObject(classId), matchRecordTypeClass); + }); + }, + skip: 'https://github.com/dart-lang/webdev/issues/2351', + ); + + test( + 'nested record type with named fields elements', + () async { + await onBreakPoint('printNestedNamedLocalRecord', (event) async { + final frame = event.topFrame!.index!; + final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); + final instanceId = instanceRef.id!; + + final elements = await getElements(instanceId); + expect( + elements, + [matchTypeInstance('bool'), matchRecordTypeInstance(length: 2)], + ); + expect( + await getElements(elements[1].id!), + [matchTypeInstance('bool'), matchTypeInstance('int')], + ); + expect( + await getDisplayedFields(instanceRef), + ['bool', '(bool, int)'], + ); + expect( + await getDisplayedFields(elements[1]), + ['bool', 'int'], + ); + }); + }, + skip: 'https://github.com/dart-lang/webdev/issues/2351', + ); + + test( + 'nested record type with named fields display', + () async { + await onBreakPoint('printNestedNamedLocalRecord', (event) async { + final frame = event.topFrame!.index!; + final instanceRef = await getInstanceRef(frame, 'record.runtimeType'); + final instance = await getObject(instanceRef.id!); + final typeClassId = instance.classRef!.id; + + expect(await getObject(typeClassId), matchRecordTypeClass); + + final typeStringRef = + await getInstanceRef(frame, 'record.runtimeType.toString()'); + final typeStringId = typeStringRef.id!; + + expect( + await getObject(typeStringId), + matchPrimitiveInstance( + kind: InstanceKind.kString, + value: '(bool, {(bool, int) inner})', + ), + ); + }); + }, + skip: 'https://github.com/dart-lang/webdev/issues/2351', + ); }); } diff --git a/dwds/test/instances/common/test_inspector.dart b/dwds/test/instances/common/test_inspector.dart index 17714617b..dc500cd5b 100644 --- a/dwds/test/instances/common/test_inspector.dart +++ b/dwds/test/instances/common/test_inspector.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:test/test.dart'; +import 'package:test_common/utilities.dart'; import 'package:vm_service/vm_service.dart'; import '../../fixtures/context.dart'; @@ -216,7 +217,15 @@ Matcher matchRecordInstanceRef({required int length}) => isA() .having((e) => e.classRef!, 'classRef', matchRecordClassRef); Matcher matchRecordTypeInstanceRef({required int length}) => isA() - .having((e) => e.kind, 'kind', InstanceKind.kRecordType) + .having( + (e) => e.kind, + 'kind', + // See https://github.com/dart-lang/sdk/commit/67e052d7e996be8ad9d02970117ffef07eab1c77. + // TODO() Can't compare edge verisons, wait for this to get to a dev release. + dartSdkIsAtLeast('3.4.0-edge.eeec4d36e3ea9b166da277a46f62d7d3b9ce645a') + ? InstanceKind.kType + : InstanceKind.kRecordType, + ) .having((e) => e.length, 'length', length) .having((e) => e.classRef!, 'classRef', matchRecordTypeClassRef); @@ -279,8 +288,14 @@ Matcher matchTypeInstance(dynamic name) => isA() Matcher matchRecordClass = matchClass(name: matchRecordClassName, libraryId: _dartCoreLibrary); -Matcher matchRecordTypeClass = - matchClass(name: matchRecordTypeClassName, libraryId: _dartRuntimeLibrary); +Matcher matchRecordTypeClass = matchClass( + name: + // See https://github.com/dart-lang/sdk/commit/67e052d7e996be8ad9d02970117ffef07eab1c77: + dartSdkIsAtLeast('3.4.0-edge.eeec4d36e3ea9b166da277a46f62d7d3b9ce645a') + ? InstanceKind.kType + : InstanceKind.kRecordType, + libraryId: _dartRuntimeLibrary, +); Matcher matchTypeClass = matchClass(name: matchTypeClassName, libraryId: _dartCoreLibrary); diff --git a/dwds/test/instances/common/type_inspection_common.dart b/dwds/test/instances/common/type_inspection_common.dart index aadf4a828..a847314a7 100644 --- a/dwds/test/instances/common/type_inspection_common.dart +++ b/dwds/test/instances/common/type_inspection_common.dart @@ -182,32 +182,37 @@ void runTests({ }); }); - test('record type', () async { - await onBreakPoint('printSimpleLocalRecord', (event) async { - final frame = event.topFrame!.index!; - final instanceRef = await getInstanceRef(frame, "(0,'a').runtimeType"); - expect(instanceRef, matchRecordTypeInstanceRef(length: 2)); - - final instanceId = instanceRef.id!; - final instance = await getObject(instanceId); - expect(instance, matchRecordTypeInstance(length: 2)); - expect( - await getElements(instanceId), - [matchTypeInstance('int'), matchTypeInstance('String')], - ); - - final classId = instanceRef.classRef!.id; - expect(await getObject(classId), matchRecordTypeClass); - expect( - await getFields(instanceRef, depth: 2), - {1: matchTypeObject, 2: matchTypeObject}, - ); - expect( - await getDisplayedFields(instanceRef), - ['int', 'String'], - ); - }); - }); + test( + 'record type', + () async { + await onBreakPoint('printSimpleLocalRecord', (event) async { + final frame = event.topFrame!.index!; + final instanceRef = + await getInstanceRef(frame, "(0,'a').runtimeType"); + expect(instanceRef, matchRecordTypeInstanceRef(length: 2)); + + final instanceId = instanceRef.id!; + final instance = await getObject(instanceId); + expect(instance, matchRecordTypeInstance(length: 2)); + expect( + await getElements(instanceId), + [matchTypeInstance('int'), matchTypeInstance('String')], + ); + + final classId = instanceRef.classRef!.id; + expect(await getObject(classId), matchRecordTypeClass); + expect( + await getFields(instanceRef, depth: 2), + {1: matchTypeObject, 2: matchTypeObject}, + ); + expect( + await getDisplayedFields(instanceRef), + ['int', 'String'], + ); + }); + }, + skip: 'https://github.com/dart-lang/webdev/issues/2351', + ); test('class type', () async { await onBreakPoint('printSimpleLocalRecord', (event) async {