Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: tests/corelib_strong/list_get_range_test.dart

Issue 2994543002: Migrated test block 13 to Dart 2.0. (Closed)
Patch Set: Address Bob's nits Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/corelib_strong/list_for_each_test.dart ('k') | tests/corelib_strong/list_growable_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib_strong/list_get_range_test.dart
diff --git a/tests/corelib_strong/list_get_range_test.dart b/tests/corelib_strong/list_get_range_test.dart
deleted file mode 100644
index 8ac315769d3ac6c7be3760e43b8602c2105060d4..0000000000000000000000000000000000000000
--- a/tests/corelib_strong/list_get_range_test.dart
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-
-testGetRange(list, start, end, bool isModifiable) {
- expectRE(() {
- list.getRange(-1, 0);
- });
- expectRE(() {
- list.getRange(0, -1);
- });
- expectRE(() {
- list.getRange(1, 0);
- });
- expectRE(() {
- list.getRange(0, list.length + 1);
- });
- expectRE(() {
- list.getRange(list.length + 1, list.length + 1);
- });
- Iterable iterable = list.getRange(start, end);
- Expect.isFalse(iterable is List);
- if (start == end) {
- Expect.isTrue(iterable.isEmpty);
- return;
- }
-
- var iterator = iterable.iterator;
- for (int i = start; i < end; i++) {
- Expect.isTrue(iterator.moveNext());
- Expect.equals(iterator.current, list[i]);
- }
- Expect.isFalse(iterator.moveNext());
-
- if (isModifiable) {
- for (int i = 0; i < list.length; i++) {
- list[i]++;
- }
-
- iterator = iterable.iterator;
- for (int i = start; i < end; i++) {
- Expect.isTrue(iterator.moveNext());
- Expect.equals(iterator.current, list[i]);
- }
- }
-}
-
-main() {
- testGetRange([1, 2], 0, 1, true);
- testGetRange([], 0, 0, true);
- testGetRange([1, 2, 3], 0, 0, true);
- testGetRange([1, 2, 3], 1, 3, true);
- testGetRange(const [1, 2], 0, 1, false);
- testGetRange(const [], 0, 0, false);
- testGetRange(const [1, 2, 3], 0, 0, false);
- testGetRange(const [1, 2, 3], 1, 3, false);
- testGetRange("abcd".codeUnits, 0, 1, false);
- testGetRange("abcd".codeUnits, 0, 0, false);
- testGetRange("abcd".codeUnits, 1, 3, false);
-
- expectRE(() => [1].getRange(-1, 1));
- expectRE(() => [3].getRange(0, -1));
- expectRE(() => [4].getRange(1, 0));
-
- var list = [1, 2, 3, 4];
- var iterable = list.getRange(1, 3);
- Expect.equals(2, iterable.first);
- Expect.equals(3, iterable.last);
- list.length = 1;
- Expect.isTrue(iterable.isEmpty);
- list.add(99);
- Expect.equals(99, iterable.single);
- list.add(499);
- Expect.equals(499, iterable.last);
- Expect.equals(2, iterable.length);
-}
-
-void expectRE(void f()) {
- Expect.throws(f, (e) => e is RangeError);
-}
« no previous file with comments | « tests/corelib_strong/list_for_each_test.dart ('k') | tests/corelib_strong/list_growable_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698