// 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. // coverage:ignore-file import 'dart:async'; import 'dart:developer'; import 'dart:isolate'; import 'package:coverage/src/util.dart'; import 'test_app_isolate.dart'; part 'test_app.g.dart'; Future main() async { for (var i = 0; i < 10; i++) { for (var j = 0; j < 10; j++) { final sum = usedMethod(i, j); if (sum != (i + j)) { throw 'bad method!'; } final multiplication = usedGeneratedMethod(i, j); if (multiplication != i * j) { throw 'bad generated method!'; } } } final port = ReceivePort(); final isolate = await Isolate.spawn(isolateTask, [port.sendPort, 1, 2], paused: true); await Service.controlWebServer(enable: true); final isolateID = Service.getIsolateID(isolate); print('isolateId = $isolateID'); isolate.addOnExitListener(port.sendPort); isolate.resume(isolate.pauseCapability!); final value = await port.first as int; if (value != 3) { throw 'expected 3!'; } final result = await retry(() async => 42, const Duration(seconds: 1)) as int; print(result); } int usedMethod(int a, int b) { return a + b; } int unusedMethod(int a, int b) { return a - b; } // ignore_for_file: unreachable_from_main, only_throw_errors // ignore_for_file: deprecated_member_use