Files
sdk/pkg/vm_service/test/debugger_inspect_test.dart
T
Ben Konyi 39e60fa3fc [ package:vm_service ] Enable more lints
Change-Id: I1a7548297fa8562ea81f3d4e32db2aba53661189
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335960
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-11-14 21:26:31 +00:00

55 lines
1.4 KiB
Dart

// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:developer';
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
import 'common/test_helper.dart';
class Point {
int x, y;
Point(this.x, this.y);
}
void testeeDo() {
inspect(Point(3, 4));
}
final tests = <IsolateTest>[
(VmService service, IsolateRef isolateRef) async {
final isolateId = isolateRef.id!;
final isolate = await service.getIsolate(isolateId);
final completer = Completer();
late StreamSubscription sub;
sub = service.onDebugEvent.listen((event) async {
if (event.kind == EventKind.kInspect) {
expect(event.inspectee!.classRef!.name, 'Point');
await sub.cancel();
await service.streamCancel(EventStreams.kDebug);
completer.complete();
}
});
await service.streamListen(EventStreams.kDebug);
// Start listening for events first.
await service.evaluate(
isolateRef.id!,
isolate.rootLib!.id!,
'testeeDo()',
);
await completer.future;
},
];
Future<void> main([args = const <String>[]]) => runIsolateTests(
args,
tests,
'debugger_inspect_test.dart',
);