93f255db7d
Author: bkonyi@google.com Migrated test block 172 to Dart 2.0 and rolled forward package:test to 0.12.24+2 to fix issues with testing streams. Migrated stream_controller_async from unittest->test. This is a duplicate copy of CL https://dart-review.googlesource.com/c/sdk/+/3685/ rebased, with merge conflict resolved. Bug: Change-Id: I56e8ef24c74dfccbda10800541d6916053d8c931 Reviewed-on: https://dart-review.googlesource.com/4621 Reviewed-by: William Hesse <whesse@google.com>
30 lines
781 B
Dart
30 lines
781 B
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:expect/expect.dart';
|
|
import 'package:async_helper/async_helper.dart';
|
|
import 'dart:async';
|
|
|
|
StackTrace captureStackTrace() {
|
|
try {
|
|
throw 0;
|
|
} catch (e, st) {
|
|
return st;
|
|
}
|
|
}
|
|
|
|
main() {
|
|
Completer completer = new Completer();
|
|
StackTrace trace = captureStackTrace();
|
|
asyncStart();
|
|
completer.future.whenComplete(() => 499).then((_) {
|
|
throw "should never be reached";
|
|
}).catchError((e, st) {
|
|
Expect.equals("c-error", e);
|
|
Expect.identical(trace, st);
|
|
asyncEnd();
|
|
});
|
|
completer.completeError("c-error", trace);
|
|
}
|