blob: d3051192ff520b0ebd493bb2fbaf17b52b3dfb08 [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 bool remove(Object value)
/// Removes value from the list. Returns true if value was in the list. Returns
/// false otherwise. The method has no effect if value value was not in the list.
/// @author kaigorodov
library remove_A01_t01;
import "../../../Utils/expect.dart";
test(List<E> create<E>([int length, E fill])) {
check(List a0, Object value, bool expected) {
List a = create();
bool r = a.remove(value);
Expect.isTrue(r is bool, "remove returned: ${r.runtimeType} ${r}, not bool");
if (r) {
Expect.equals(a0.length-1, a.length);
} else {
Expect.equals(a0.length, a.length);
check([], 1, false);
check([1], 1, true);
check(new List.from([]), true, false);
List a = new List.empty(growable: true);
check(a, 2, false);
check(a, 2, true);