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

Side by Side Diff: tests/language/core_type_check_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 check(value, expectComparable, expectPattern) { 7 check(value, expectComparable, expectPattern) {
8 Expect.equals(expectComparable, value is Comparable); 8 Expect.equals(expectComparable, value is Comparable);
9 Expect.equals(expectPattern, value is Pattern); 9 Expect.equals(expectPattern, value is Pattern);
10 } 10 }
11 11
12 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1)); 12 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
13 13
14 class A implements Comparable { 14 class A implements Comparable {
15 int compareTo(o) => 0; 15 int compareTo(o) => 0;
16 } 16 }
17 17
18 class B { 18 class B {}
19 }
20 19
21 class C implements Pattern { 20 class C implements Pattern {
22 matchAsPrefix(String s, [int start = 0]) => null; 21 matchAsPrefix(String s, [int start = 0]) => null;
23 allMatches(String s, [int start = 0]) => null; 22 allMatches(String s, [int start = 0]) => null;
24 } 23 }
25 24
26 class D implements Pattern, Comparable { 25 class D implements Pattern, Comparable {
27 int compareTo(o) => 0; 26 int compareTo(o) => 0;
28 matchAsPrefix(String s, [int start = 0]) => null; 27 matchAsPrefix(String s, [int start = 0]) => null;
29 allMatches(String s, [int start = 0]) => null; 28 allMatches(String s, [int start = 0]) => null;
30 } 29 }
31 30
32 main() { 31 main() {
33 var things = [[], 4, 4.2, 'foo', new Object(), new A(), new B(), 32 var things = [
34 new C(), new D()]; 33 [],
34 4,
35 4.2,
36 'foo',
37 new Object(),
38 new A(),
39 new B(),
40 new C(),
41 new D()
42 ];
35 43
36 check(things[inscrutable(0)], false, false); // List 44 check(things[inscrutable(0)], false, false); // List
37 check(things[inscrutable(1)], true, false); // int 45 check(things[inscrutable(1)], true, false); // int
38 check(things[inscrutable(2)], true, false); // num 46 check(things[inscrutable(2)], true, false); // num
39 check(things[inscrutable(3)], true, true); // string 47 check(things[inscrutable(3)], true, true); // string
40 check(things[inscrutable(4)], false, false); // Object 48 check(things[inscrutable(4)], false, false); // Object
41 check(things[inscrutable(5)], true, false); // A 49 check(things[inscrutable(5)], true, false); // A
42 check(things[inscrutable(6)], false, false); // B 50 check(things[inscrutable(6)], false, false); // B
43 check(things[inscrutable(7)], false, true); // C 51 check(things[inscrutable(7)], false, true); // C
44 check(things[inscrutable(8)], true, true); // D 52 check(things[inscrutable(8)], true, true); // D
45 } 53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698