blob: 9ba8fe1664ae3aede929a344c29ff4daf75dd558 [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 abstract Iterable<E> take(int n)
* It is an error if n is negative.
* @description checks that a RangeError is thrown if n is negative.
* @author kaigorodov
*/
import "../../../Utils/expect.dart";
check(List a, int n) {
Iterable res;
try {
res=a.take(n);
Expect.fail("RangeError expected when calling a.skip");
} on RangeError catch(ok) {}
}
main() {
check([1,2,-3,4], -1);
check(const[1,2,-5,-6, 100], -1);
check(const[null,2,-5,-6, 100], -1000);
}