blob: 992ed99fa55356676b0c1fd3b1e6ba1d3280bfd7 [file] [log] [blame]
// Copyright (c) 2011, 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.
/// @assertion Stream.fromFuture(Future<T> future)
/// When the future completes, the stream will fire one event, either data or
/// error, and then close with a done-event.
/// @description Checks that if the future completes normally, the stream will
/// fire one data event, and then close with a done-event.
/// @author kaigorodov
import "dart:async";
import "../../../Utils/expect.dart";
main() {
// using immediate sync future[123], new Stream.fromFuture(new Future.sync(() => 123)));
// using immediate future["abc"], new Stream.fromFuture(new Future(() => "abc")));
// using completable future
Completer completer = new Completer();[3.14], new Stream.fromFuture(completer.future));