blob: 852633bf1e2270b2d1016f20c20e38e22c69ceab [file] [log] [blame]
// Copyright (c) 2016, 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<S> map<S>(S convert(T event))
/// For each data event, o, in this stream, the returned stream provides
/// a data event with the value convert(o). If convert throws, the returned
/// stream reports the exception as an error event instead.
/// @description Checks that each error thrown by [convert] is passed to returned
/// stream.
/// @author
library map_A02_t01;
import "dart:async";
import "../../../Utils/expect.dart";
void test(CreateStreamFunction create) {
Stream stream = create(["a", "b", "c"]);[], ["a", "b", "c"], => throw e));
stream = create([1, 2, 3, 4, 5]);[1, 3, 5], [2, 4], => e.isOdd ? e : throw e));