Skip to content
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