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

Side by Side Diff: tests/lib/mirrors/method_mirror_properties_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library lib; 5 library lib;
6 6
7 @MirrorsUsed(targets: "lib") 7 @MirrorsUsed(targets: "lib")
8 import "dart:mirrors"; 8 import "dart:mirrors";
9 9
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
11 11
12 doNothing42() {} 12 doNothing42() {}
13 13
14 int _x = 5; 14 int _x = 5;
15 int get topGetter => _x; 15 int get topGetter => _x;
16 void set topSetter(x) { _x = x; } 16 void set topSetter(x) {
17 _x = x;
18 }
17 19
18 abstract class AbstractC { 20 abstract class AbstractC {
19
20 AbstractC(); 21 AbstractC();
21 22
22 void bar(); 23 void bar();
23 get priv; 24 get priv;
24 set priv(value); 25 set priv(value);
25 } 26 }
26 27
27 abstract class C extends AbstractC { 28 abstract class C extends AbstractC {
28
29 static foo() {} 29 static foo() {}
30 30
31 C(); 31 C();
32 C.other(); 32 C.other();
33 C.other2() : this.other(); 33 C.other2() : this.other();
34 34
35 var _priv; 35 var _priv;
36 get priv => _priv; 36 get priv => _priv;
37 set priv(value) => _priv = value; 37 set priv(value) => _priv = value;
38 } 38 }
39 39
40 checkKinds(method, kinds) { 40 checkKinds(method, kinds) {
41 Expect.equals(kinds[0], method.isStatic, "isStatic"); 41 Expect.equals(kinds[0], method.isStatic, "isStatic");
42 Expect.equals(kinds[1], method.isAbstract, "isAbstract"); 42 Expect.equals(kinds[1], method.isAbstract, "isAbstract");
43 Expect.equals(kinds[2], method.isGetter, "isGetter"); 43 Expect.equals(kinds[2], method.isGetter, "isGetter");
44 Expect.equals(kinds[3], method.isSetter, "isSetter"); 44 Expect.equals(kinds[3], method.isSetter, "isSetter");
45 Expect.equals(kinds[4], method.isConstructor, "isConstructor"); 45 Expect.equals(kinds[4], method.isConstructor, "isConstructor");
46 } 46 }
47 47
48 main() { 48 main() {
49 // Top level functions should be static. 49 // Top level functions should be static.
50 var closureMirror = reflect(doNothing42); 50 var closureMirror = reflect(doNothing42);
51 checkKinds(closureMirror.function, 51 checkKinds(closureMirror.function, [true, false, false, false, false]);
52 [true, false, false, false, false]);
53 var libraryMirror = reflectClass(C).owner; 52 var libraryMirror = reflectClass(C).owner;
54 checkKinds(libraryMirror.declarations[#topGetter], 53 checkKinds(libraryMirror.declarations[#topGetter],
55 [true, false, true, false, false]); 54 [true, false, true, false, false]);
56 checkKinds(libraryMirror.declarations[const Symbol("topSetter=")], 55 checkKinds(libraryMirror.declarations[const Symbol("topSetter=")],
57 [true, false, false, true, false]); 56 [true, false, false, true, false]);
58 var classMirror; 57 var classMirror;
59 classMirror = reflectClass(C); 58 classMirror = reflectClass(C);
60 checkKinds(classMirror.declarations[#foo], 59 checkKinds(
61 [true, false, false, false, false]); 60 classMirror.declarations[#foo], [true, false, false, false, false]);
62 checkKinds(classMirror.declarations[#priv], 61 checkKinds(
63 [false, false, true, false, false]); 62 classMirror.declarations[#priv], [false, false, true, false, false]);
64 checkKinds(classMirror.declarations[const Symbol("priv=")], 63 checkKinds(classMirror.declarations[const Symbol("priv=")],
65 [false, false, false, true, false]); 64 [false, false, false, true, false]);
66 checkKinds(classMirror.declarations[#C], 65 checkKinds(classMirror.declarations[#C], [false, false, false, false, true]);
67 [false, false, false, false, true]); 66 checkKinds(
68 checkKinds(classMirror.declarations[#C.other], 67 classMirror.declarations[#C.other], [false, false, false, false, true]);
69 [false, false, false, false, true]); 68 checkKinds(
70 checkKinds(classMirror.declarations[#C.other2], 69 classMirror.declarations[#C.other2], [false, false, false, false, true]);
71 [false, false, false, false, true]);
72 classMirror = reflectClass(AbstractC); 70 classMirror = reflectClass(AbstractC);
73 checkKinds(classMirror.declarations[#AbstractC], 71 checkKinds(
74 [false, false, false, false, true]); 72 classMirror.declarations[#AbstractC], [false, false, false, false, true]);
75 checkKinds(classMirror.declarations[#bar], 73 checkKinds(
76 [false, true, false, false, false]); 74 classMirror.declarations[#bar], [false, true, false, false, false]);
77 checkKinds(classMirror.declarations[#priv], 75 checkKinds(
78 [false, true, true, false, false]); 76 classMirror.declarations[#priv], [false, true, true, false, false]);
79 checkKinds(classMirror.declarations[const Symbol("priv=")], 77 checkKinds(classMirror.declarations[const Symbol("priv=")],
80 [false, true, false, true, false]); 78 [false, true, false, true, false]);
81 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698