dart-sdk/pkg/vm_service/test/rpc_error_test.dart
Alexander Markov 3e0abdbb98 Reland "[vm] Enable new implementation of async/async* in JIT mode"
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I5b8720b8ef5b8d28773d26c7e94c2e78d876c9d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247603
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-06-09 15:24:13 +00:00

34 lines
1 KiB
Dart

// Copyright (c) 2021, 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 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
import 'common/test_helper.dart';
var tests = <VMTest>[
(VmService vm) async {
// Invoke a non-existent RPC.
try {
final res = await vm.callMethod('foo');
fail('Expected RPCError, got $res');
} on RPCError catch (e, st) {
// Ensure stack trace contains actual invocation path.
final stack = st.toString().split('\n');
expect(stack.where((e) => e.contains('VmService.callMethod')).length, 1);
// Call to vm.callMethod('foo').
expect(
stack.where((e) => e.contains('test/rpc_error_test.dart')).length, 1);
} catch (e) {
fail('Expected RPCError, got $e');
}
},
];
main([args = const <String>[]]) async => await runVMTests(
args,
tests,
'rpc_error_test.dart',
);