Skip to content

Commit

Permalink
Skip record type inspection tests (#2352)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette authored Jan 22, 2024
1 parent 0c4d9e5 commit a5ad753
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 170 deletions.
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

0 comments on commit a5ad753

Please sign in to comment.