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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 6
7 main() { 7 main() {
8 List<int> list1 = <int>[1, 2, 3]; 8 List<int> list1 = <int>[1, 2, 3];
9 List<int> list2 = const <int>[4, 5]; 9 List<int> list2 = const <int>[4, 5];
10 List<String> list3 = <String>[]; 10 List<String> list3 = <String>[];
11 Set<int> set1 = new Set<int>(); 11 Set<int> set1 = new Set<int>();
12 set1..add(11) 12 set1..add(11)..add(12)..add(13);
13 ..add(12)
14 ..add(13);
15 Set set2 = new Set(); 13 Set set2 = new Set();
16 14
17 Expect.equals(2, list1.firstWhere((x) => x.isEven)); 15 Expect.equals(2, list1.firstWhere((x) => x.isEven));
18 Expect.equals(1, list1.firstWhere((x) => x.isOdd)); 16 Expect.equals(1, list1.firstWhere((x) => x.isOdd));
19 Expect.throws(() => list1.firstWhere((x) => x > 3), 17 Expect.throws(() => list1.firstWhere((x) => x > 3), (e) => e is StateError);
20 (e) => e is StateError);
21 Expect.equals(null, list1.firstWhere((x) => x > 3, orElse: () => null)); 18 Expect.equals(null, list1.firstWhere((x) => x > 3, orElse: () => null));
22 Expect.equals(499, list1.firstWhere((x) => x > 3, orElse: () => 499)); 19 Expect.equals(499, list1.firstWhere((x) => x > 3, orElse: () => 499));
23 20
24 Expect.equals(4, list2.firstWhere((x) => x.isEven)); 21 Expect.equals(4, list2.firstWhere((x) => x.isEven));
25 Expect.equals(5, list2.firstWhere((x) => x.isOdd)); 22 Expect.equals(5, list2.firstWhere((x) => x.isOdd));
26 Expect.throws(() => list2.firstWhere((x) => x == 0), 23 Expect.throws(() => list2.firstWhere((x) => x == 0), (e) => e is StateError);
27 (e) => e is StateError);
28 Expect.equals(null, list2.firstWhere((x) => false, orElse: () => null)); 24 Expect.equals(null, list2.firstWhere((x) => false, orElse: () => null));
29 Expect.equals(499, list2.firstWhere((x) => false, orElse: () => 499)); 25 Expect.equals(499, list2.firstWhere((x) => false, orElse: () => 499));
30 26
31 Expect.throws(() => list3.firstWhere((x) => x == 0), 27 Expect.throws(() => list3.firstWhere((x) => x == 0), (e) => e is StateError);
32 (e) => e is StateError);
33 Expect.throws(() => list3.firstWhere((x) => true), (e) => e is StateError); 28 Expect.throws(() => list3.firstWhere((x) => true), (e) => e is StateError);
34 Expect.equals(null, list3.firstWhere((x) => true, orElse: () => null)); 29 Expect.equals(null, list3.firstWhere((x) => true, orElse: () => null));
35 Expect.equals("str", list3.firstWhere((x) => false, orElse: () => "str")); 30 Expect.equals("str", list3.firstWhere((x) => false, orElse: () => "str"));
36 31
37 Expect.equals(12, set1.firstWhere((x) => x.isEven)); 32 Expect.equals(12, set1.firstWhere((x) => x.isEven));
38 var odd = set1.firstWhere((x) => x.isOdd); 33 var odd = set1.firstWhere((x) => x.isOdd);
39 Expect.isTrue(odd == 11 || odd == 13); 34 Expect.isTrue(odd == 11 || odd == 13);
40 Expect.throws(() => set1.firstWhere((x) => false), (e) => e is StateError); 35 Expect.throws(() => set1.firstWhere((x) => false), (e) => e is StateError);
41 Expect.equals(null, set1.firstWhere((x) => false, orElse: () => null)); 36 Expect.equals(null, set1.firstWhere((x) => false, orElse: () => null));
42 Expect.equals(499, set1.firstWhere((x) => false, orElse: () => 499)); 37 Expect.equals(499, set1.firstWhere((x) => false, orElse: () => 499));
43 38
44 Expect.throws(() => set2.firstWhere((x) => false), (e) => e is StateError); 39 Expect.throws(() => set2.firstWhere((x) => false), (e) => e is StateError);
45 Expect.throws(() => set2.firstWhere((x) => true), (e) => e is StateError); 40 Expect.throws(() => set2.firstWhere((x) => true), (e) => e is StateError);
46 Expect.equals(null, set2.firstWhere((x) => true, orElse: () => null)); 41 Expect.equals(null, set2.firstWhere((x) => true, orElse: () => null));
47 Expect.equals(499, set2.firstWhere((x) => false, orElse: () => 499)); 42 Expect.equals(499, set2.firstWhere((x) => false, orElse: () => 499));
48 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698