blob: 1a03c07cae81fe8ee293954434d645d5a9c4b0eb [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.
// @dart = 2.9
/// @assertion abstract Stream<T> asStream()
/// The stream will produce single data or error event containing the completion
/// result of this future, and then it will close with a done event.
/// @description Checks that the stream is closed after the completion value is
/// send.
/// @author kaigorodov
import "dart:async";
import "../../../Utils/expect.dart";
String output1;
main() {
var value = 99;
Completer completer = new Completer();
Future future = completer.future;
Stream stream = future.asStream();
int count = 1;
(var event) {count = count + 1;}, // should be invoked first
onDone: (){
Expect.equals(2, count);
} // should be invoked second