blob: 788e49e8fe486b7085f032397d9bc9219a78dd7f [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 Future<T> elementAt(int index)
/// Returns the value of the indexth data event of this stream.
/// Stops listening to the stream after the indexth data event has been received.
/// @description Checks that it stops listening to the stream after a value has
/// been found.
/// @author
library elementAt_A01_t02;
import "dart:async";
import "../../../Utils/expect.dart";
void test(CreateStreamFunction create) {
Stream<int> s = create(new Iterable<int>.generate(100, (int i) => i));
(int t) {
if (!s.isBroadcast) {
Expect.throws(() => s.listen((_) {}));