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

Side by Side Diff: tests/corelib/iterable_contains_test.dart

Issue 2997533002: Migrate test block 10 to Dart 2.0. (Closed)
Patch Set: Fix merge error 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 unified diff | Download patch
« no previous file with comments | « tests/corelib/iterable_contains2_test.dart ('k') | tests/corelib/iterable_element_at_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6
7 // Tests for the contains methods on lists.
8
9 test(list, notInList) {
10 testList(list) {
11 for (int i = 0; i < list.length; i++) {
12 var elem = list[i];
13 Expect.isTrue(list.contains(list[i]), "$list.contains($elem)");
14 }
15 Expect.isFalse(list.contains(notInList), "!$list.contains($notInList)");
16 }
17
18 List fixedList = new List(list.length);
19 List growList = new List();
20 for (int i = 0; i < list.length; i++) {
21 fixedList[i] = list[i];
22 growList.add(list[i]);
23 }
24 testList(list);
25 testList(fixedList);
26 testList(growList);
27 }
28
29 class C {
30 const C();
31 }
32
33 class Niet {
34 bool operator ==(other) => false;
35 }
36
37 main() {
38 test(const <String>["a", "b", "c", null], "d");
39 test(const <int>[1, 2, 3, null], 0);
40 test(const <bool>[true, false], null);
41 test(const <C>[const C(), const C(), null], new C());
42 test(<C>[new C(), new C(), new C(), null], new C());
43 test(const <double>[0.0, 1.0, 5e-324, 1e+308, double.INFINITY], 2.0);
44 Expect.isTrue(const <double>[-0.0].contains(0.0));
45 Expect.isFalse(const <double>[double.NAN].contains(double.NAN));
46 var niet = new Niet();
47 Expect.isFalse([niet].contains(niet));
48 }
OLDNEW
« no previous file with comments | « tests/corelib/iterable_contains2_test.dart ('k') | tests/corelib/iterable_element_at_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698