blob: 176cff213a6723b7b3150b38f2c8ece22d1949c9 [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 Iterable<E> where(bool f(E element))
/// As long as the returned [Iterable] is not iterated over, the supplied
/// function [test] will not be invoked.
/// @description Checks that filtering happens lazily.
/// @author
import "dart:collection";
import "../../../Utils/expect.dart";
bool test(var value) {"test($value) called");
return true;
main() {
new DoubleLinkedQueue.from([1, 2, -3, 4]).where(test);
new DoubleLinkedQueue.from([]).where(test);
new DoubleLinkedQueue.from(const[null, 2, -5, -6, 100]).where(test);