Skip to content

Skip record type inspection tests #2352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
330 changes: 189 additions & 141 deletions dwds/test/instances/common/record_type_inspection_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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',
);
});
}
Loading