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>
32 lines
815 B
Dart
32 lines
815 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() {
|
|
StackTrace trace = captureStackTrace();
|
|
var controller;
|
|
controller = new StreamController(onListen: () {
|
|
controller.addError("error", trace);
|
|
controller.close();
|
|
});
|
|
asyncStart();
|
|
controller.stream.handleError((e, st) {
|
|
Expect.equals("error", e);
|
|
Expect.identical(trace, st);
|
|
}).listen((x) {
|
|
throw "should never be reached";
|
|
}, onDone: asyncEnd);
|
|
}
|