// Copyright (c) 2019, 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.

// SharedOptions=--enable-experiment=control-flow-collections,spread-collections

// Test that a null stream expression procudes a runtime error.
import 'package:async_helper/async_helper.dart';

void main() {
  asyncTest(() async {
    // Null stream.
    Stream<int> nullStream = null;
    asyncExpectThrows<NoSuchMethodError>(
        () async => <int>[await for (var i in nullStream) 1]);
    asyncExpectThrows<NoSuchMethodError>(
        () async => <int, int>{await for (var i in nullStream) 1: 1});
    asyncExpectThrows<NoSuchMethodError>(
        () async => <int>{await for (var i in nullStream) 1});
  });
}

// Copyright (c) 2019, 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.

// SharedOptions=--enable-experiment=control-flow-collections,spread-collections

// Test that a null stream expression procudes a runtime error.
import 'package:async_helper/async_helper.dart';

void main() {
  asyncTest(() async {
    // Null stream.
    Stream<int> nullStream = null;
    asyncExpectThrows<Error>(
        () async => <int>[await for (var i in nullStream) 1]);
    asyncExpectThrows<Error>(
        () async => <int, int>{await for (var i in nullStream) 1: 1});
    asyncExpectThrows<Error>(
        () async => <int>{await for (var i in nullStream) 1});
  });
}

Update expected error NoSuchMethodError --> Error
[tests] Update expected error NoSuchMethodError --> Error

Most (all?) implementations now throw ArgumentError since the
StreamIterator constructor no longer accepts null but the actual
type is not specified.
https://dart-review.googlesource.com/c/sdk/+/98001.

Change-Id: I10a24a67aa7353552c56d435ef206a2bc4f842fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100987
Commit-Queue: Nicholas Shahan <03847abd2d8aadfe859ecb98095a31f9f515dc47@google.com>
Reviewed-by: Bob Nystrom <afede3a9ebedb865bee78398feff6fbe97068f17@google.com>
