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

Side by Side Diff: tests/lib/mirrors/operator_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 /// Test operators. 5 /// Test operators.
6 library test.operator_test; 6 library test.operator_test;
7 7
8 @MirrorsUsed(targets: "test.operator_test") 8 @MirrorsUsed(targets: "test.operator_test")
9 import 'dart:mirrors'; 9 import 'dart:mirrors';
10 10
(...skipping 24 matching lines...) Expand all
35 Foo operator -(Foo a) {} 35 Foo operator -(Foo a) {}
36 36
37 // TODO(ahe): use void when dart2js reifies that type. 37 // TODO(ahe): use void when dart2js reifies that type.
38 operator []=(int a, Foo b) {} 38 operator []=(int a, Foo b) {}
39 } 39 }
40 40
41 void main() { 41 void main() {
42 ClassMirror cls = reflectClass(Foo); 42 ClassMirror cls = reflectClass(Foo);
43 var operators = new Map<Symbol, MethodMirror>(); 43 var operators = new Map<Symbol, MethodMirror>();
44 var operatorParameters = new Map<Symbol, List>(); 44 var operatorParameters = new Map<Symbol, List>();
45 var returnTypes = new Map<Symbol, Mirror>(); 45 var returnTypes = new Map<Symbol, Mirror>();
46 for (MethodMirror method in cls.declarations.values.where( 46 for (MethodMirror method in cls.declarations.values
47 (d) => d is MethodMirror && !d.isConstructor)) { 47 .where((d) => d is MethodMirror && !d.isConstructor)) {
48 Expect.isTrue(method.isRegularMethod); 48 Expect.isTrue(method.isRegularMethod);
49 Expect.isTrue(method.isOperator); 49 Expect.isTrue(method.isOperator);
50 Expect.isFalse(method.isGetter); 50 Expect.isFalse(method.isGetter);
51 Expect.isFalse(method.isSetter); 51 Expect.isFalse(method.isSetter);
52 Expect.isFalse(method.isAbstract); 52 Expect.isFalse(method.isAbstract);
53 operators[method.simpleName] = method; 53 operators[method.simpleName] = method;
54 operatorParameters[method.simpleName] = method.parameters; 54 operatorParameters[method.simpleName] = method.parameters;
55 returnTypes[method.simpleName] = method.returnType; 55 returnTypes[method.simpleName] = method.returnType;
56 } 56 }
57 expect(OPERATORS, operators); 57 expect(OPERATORS, operators);
58 expect(PARAMETERS, operatorParameters); 58 expect(PARAMETERS, operatorParameters);
59 expect(RETURN_TYPES, returnTypes); 59 expect(RETURN_TYPES, returnTypes);
60 } 60 }
61 61
62 const String OPERATORS = '{' 62 const String OPERATORS = '{'
63 '%: Method(s(%) in s(Foo)), ' 63 '%: Method(s(%) in s(Foo)), '
64 '&: Method(s(&) in s(Foo)), ' 64 '&: Method(s(&) in s(Foo)), '
65 '*: Method(s(*) in s(Foo)), ' 65 '*: Method(s(*) in s(Foo)), '
66 '+: Method(s(+) in s(Foo)), ' 66 '+: Method(s(+) in s(Foo)), '
67 '-: Method(s(-) in s(Foo)), ' 67 '-: Method(s(-) in s(Foo)), '
68 '/: Method(s(/) in s(Foo)), ' 68 '/: Method(s(/) in s(Foo)), '
69 '<: Method(s(<) in s(Foo)), ' 69 '<: Method(s(<) in s(Foo)), '
70 '<<: Method(s(<<) in s(Foo)), ' 70 '<<: Method(s(<<) in s(Foo)), '
71 '<=: Method(s(<=) in s(Foo)), ' 71 '<=: Method(s(<=) in s(Foo)), '
72 '==: Method(s(==) in s(Foo)), ' 72 '==: Method(s(==) in s(Foo)), '
73 '>: Method(s(>) in s(Foo)), ' 73 '>: Method(s(>) in s(Foo)), '
74 '>=: Method(s(>=) in s(Foo)), ' 74 '>=: Method(s(>=) in s(Foo)), '
75 '>>: Method(s(>>) in s(Foo)), ' 75 '>>: Method(s(>>) in s(Foo)), '
76 '[]: Method(s([]) in s(Foo)), ' 76 '[]: Method(s([]) in s(Foo)), '
77 '[]=: Method(s([]=) in s(Foo)), ' 77 '[]=: Method(s([]=) in s(Foo)), '
78 '^: Method(s(^) in s(Foo)), ' 78 '^: Method(s(^) in s(Foo)), '
79 'unary-: Method(s(unary-) in s(Foo)), ' 79 'unary-: Method(s(unary-) in s(Foo)), '
80 '|: Method(s(|) in s(Foo)), ' 80 '|: Method(s(|) in s(Foo)), '
81 '~: Method(s(~) in s(Foo)), ' 81 '~: Method(s(~) in s(Foo)), '
82 '~/: Method(s(~/) in s(Foo))' 82 '~/: Method(s(~/) in s(Foo))'
83 '}'; 83 '}';
84 84
85 const String DYNAMIC = 'Type(s(dynamic), top-level)'; 85 const String DYNAMIC = 'Type(s(dynamic), top-level)';
86 86
87 const String FOO = 'Class(s(Foo) in s(test.operator_test), top-level)'; 87 const String FOO = 'Class(s(Foo) in s(test.operator_test), top-level)';
88 88
89 const String INT = 'Class(s(int) in s(dart.core), top-level)'; 89 const String INT = 'Class(s(int) in s(dart.core), top-level)';
90 90
91 const String BOOL = 'Class(s(bool) in s(dart.core), top-level)'; 91 const String BOOL = 'Class(s(bool) in s(dart.core), top-level)';
92 92
93 const String PARAMETERS = '{' 93 const String PARAMETERS = '{'
94 '%: [Parameter(s(a) in s(%), type = $FOO)], ' 94 '%: [Parameter(s(a) in s(%), type = $FOO)], '
95 '&: [Parameter(s(a) in s(&), type = $FOO)], ' 95 '&: [Parameter(s(a) in s(&), type = $FOO)], '
96 '*: [Parameter(s(a) in s(*), type = $FOO)], ' 96 '*: [Parameter(s(a) in s(*), type = $FOO)], '
97 '+: [Parameter(s(a) in s(+), type = $FOO)], ' 97 '+: [Parameter(s(a) in s(+), type = $FOO)], '
98 '-: [Parameter(s(a) in s(-), type = $FOO)], ' 98 '-: [Parameter(s(a) in s(-), type = $FOO)], '
99 '/: [Parameter(s(a) in s(/), type = $FOO)], ' 99 '/: [Parameter(s(a) in s(/), type = $FOO)], '
100 '<: [Parameter(s(a) in s(<), type = $FOO)], ' 100 '<: [Parameter(s(a) in s(<), type = $FOO)], '
101 '<<: [Parameter(s(a) in s(<<), type = $FOO)], ' 101 '<<: [Parameter(s(a) in s(<<), type = $FOO)], '
102 '<=: [Parameter(s(a) in s(<=), type = $FOO)], ' 102 '<=: [Parameter(s(a) in s(<=), type = $FOO)], '
103 '==: [Parameter(s(a) in s(==), type = $DYNAMIC)], ' 103 '==: [Parameter(s(a) in s(==), type = $DYNAMIC)], '
104 '>: [Parameter(s(a) in s(>), type = $FOO)], ' 104 '>: [Parameter(s(a) in s(>), type = $FOO)], '
105 '>=: [Parameter(s(a) in s(>=), type = $FOO)], ' 105 '>=: [Parameter(s(a) in s(>=), type = $FOO)], '
106 '>>: [Parameter(s(a) in s(>>), type = $FOO)], ' 106 '>>: [Parameter(s(a) in s(>>), type = $FOO)], '
107 '[]: [Parameter(s(a) in s([]), type = $INT)], ' 107 '[]: [Parameter(s(a) in s([]), type = $INT)], '
108 '[]=: [Parameter(s(a) in s([]=), type = $INT), ' 108 '[]=: [Parameter(s(a) in s([]=), type = $INT), '
109 'Parameter(s(b) in s([]=), type = $FOO)], ' 109 'Parameter(s(b) in s([]=), type = $FOO)], '
110 '^: [Parameter(s(a) in s(^), type = $FOO)], ' 110 '^: [Parameter(s(a) in s(^), type = $FOO)], '
111 'unary-: [], ' 111 'unary-: [], '
112 '|: [Parameter(s(a) in s(|), type = $FOO)], ' 112 '|: [Parameter(s(a) in s(|), type = $FOO)], '
113 '~: [], ' 113 '~: [], '
114 '~/: [Parameter(s(a) in s(~/), type = $FOO)]' 114 '~/: [Parameter(s(a) in s(~/), type = $FOO)]'
115 '}'; 115 '}';
116 116
117 const String RETURN_TYPES = '{' 117 const String RETURN_TYPES = '{'
118 '%: $FOO, ' 118 '%: $FOO, '
119 '&: $FOO, ' 119 '&: $FOO, '
120 '*: $FOO, ' 120 '*: $FOO, '
121 '+: $FOO, ' 121 '+: $FOO, '
122 '-: $FOO, ' 122 '-: $FOO, '
123 '/: $FOO, ' 123 '/: $FOO, '
124 '<: $FOO, ' 124 '<: $FOO, '
125 '<<: $FOO, ' 125 '<<: $FOO, '
126 '<=: $FOO, ' 126 '<=: $FOO, '
127 '==: $BOOL, ' 127 '==: $BOOL, '
128 '>: $FOO, ' 128 '>: $FOO, '
129 '>=: $FOO, ' 129 '>=: $FOO, '
130 '>>: $FOO, ' 130 '>>: $FOO, '
131 '[]: $FOO, ' 131 '[]: $FOO, '
132 '[]=: $DYNAMIC, ' 132 '[]=: $DYNAMIC, '
133 '^: $FOO, ' 133 '^: $FOO, '
134 'unary-: $FOO, ' 134 'unary-: $FOO, '
135 '|: $FOO, ' 135 '|: $FOO, '
136 '~: $FOO, ' 136 '~: $FOO, '
137 '~/: $FOO' 137 '~/: $FOO'
138 '}'; 138 '}';
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698