Files
sdk/tests/lib_2/async/run_zoned8_test.dart
T
Lasse R.H. Nielsen 2876623654 Check function types in the correct order in runZoned.
A change made it check for a unary function type before a binary, so `(o, [stack])=>...` would not get a stack trace.

Fixes #33589

Bug: http://dartbug.com/33589
Change-Id: I69793eb74501c1f7fe07b6c90115b2f90f4d95df
Reviewed-on: https://dart-review.googlesource.com/61936
Reviewed-by: Florian Loitsch <floitsch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-06-25 19:43:14 +00:00

44 lines
1.0 KiB
Dart

// Copyright (c) 2013, 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
import 'catch_errors.dart';
main() {
asyncStart();
Completer done = new Completer();
var events = [];
// Test runZoned with periodic Timers.
runZoned(() {
int counter = 0;
new Timer.periodic(const Duration(milliseconds: 50), (timer) {
if (counter == 1) {
timer.cancel();
done.complete(true);
}
counter++;
events.add(counter);
throw counter;
});
}, onError: (e, [s]) {
events.add("error: $e");
Expect.isNotNull(s); // Regression test for http://dartbug.com/33589
});
done.future.whenComplete(() {
Expect.listEquals([
"main exit",
1,
"error: 1",
2,
"error: 2",
], events);
asyncEnd();
});
events.add("main exit");
}