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

Side by Side Diff: tests/lib_strong/mirrors/abstract_class_test.dart

Issue 2770063002: Revert "Format all multitests" (Closed)
Patch Set: Created 3 years, 9 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 test.abstract_class_test; 5 library test.abstract_class_test;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 void main() { 10 void main() {
11 testSimple(); 11 testSimple();
12 testFunctionType(); 12 testFunctionType();
13 testFakeFunction(); 13 testFakeFunction();
14 testGeneric(); 14 testGeneric();
15 testAnonMixinApplication(); 15 testAnonMixinApplication();
16 testNamedMixinApplication(); 16 testNamedMixinApplication();
17 } 17 }
18 18
19 abstract class Foo { 19 abstract class Foo {
20 foo(); 20 foo();
21 } 21 }
22
23 class Bar extends Foo { 22 class Bar extends Foo {
24 foo() {} 23 foo() {}
25 } 24 }
26 25
27 testSimple() { 26 testSimple() {
28 Expect.isTrue(reflectClass(Foo).isAbstract); 27 Expect.isTrue(reflectClass(Foo).isAbstract);
29 Expect.isFalse(reflectClass(Bar).isAbstract); 28 Expect.isFalse(reflectClass(Bar).isAbstract);
30 Expect.isTrue(reflect(new Bar()).type.superclass.isAbstract); 29 Expect.isTrue(reflect(new Bar()).type.superclass.isAbstract);
31 Expect.isFalse(reflect(new Bar()).type.isAbstract); 30 Expect.isFalse(reflect(new Bar()).type.isAbstract);
32 } 31 }
33 32
33
34 void baz() {} 34 void baz() {}
35 35
36 testFunctionType() { 36 testFunctionType() {
37 Expect.isFalse(reflect(baz).type.isAbstract); 37 Expect.isFalse(reflect(baz).type.isAbstract);
38 } 38 }
39 39
40 abstract class FunctionFoo implements Function { 40 abstract class FunctionFoo implements Function {
41 call(); 41 call();
42 } 42 }
43
44 class FunctionBar extends FunctionFoo { 43 class FunctionBar extends FunctionFoo {
45 call() {} 44 call() {}
46 } 45 }
47 46
48 testFakeFunction() { 47 testFakeFunction() {
49 Expect.isTrue(reflectClass(FunctionFoo).isAbstract); 48 Expect.isTrue(reflectClass(FunctionFoo).isAbstract);
50 Expect.isFalse(reflectClass(FunctionBar).isAbstract); 49 Expect.isFalse(reflectClass(FunctionBar).isAbstract);
51 Expect.isTrue(reflect(new FunctionBar()).type.superclass.isAbstract); 50 Expect.isTrue(reflect(new FunctionBar()).type.superclass.isAbstract);
52 Expect.isFalse(reflect(new FunctionBar()).type.isAbstract); 51 Expect.isFalse(reflect(new FunctionBar()).type.isAbstract);
53 } 52 }
54 53
55 abstract class GenericFoo<T> { 54 abstract class GenericFoo<T> {
56 T genericFoo(); 55 T genericFoo();
57 } 56 }
58
59 class GenericBar<T> extends GenericFoo<T> { 57 class GenericBar<T> extends GenericFoo<T> {
60 T genericFoo() {} 58 T genericFoo() {}
61 } 59 }
62 60
63 testGeneric() { 61 testGeneric() {
64 // Unbound. 62 // Unbound.
65 Expect.isTrue(reflectClass(GenericFoo).isAbstract); 63 Expect.isTrue(reflectClass(GenericFoo).isAbstract);
66 Expect.isFalse(reflectClass(GenericBar).isAbstract); 64 Expect.isFalse(reflectClass(GenericBar).isAbstract);
67 // Bound. 65 // Bound.
68 Expect.isTrue(reflect(new GenericBar<int>()).type.superclass.isAbstract); 66 Expect.isTrue(reflect(new GenericBar<int>()).type.superclass.isAbstract);
69 Expect.isFalse(reflect(new GenericBar<int>()).type.isAbstract); 67 Expect.isFalse(reflect(new GenericBar<int>()).type.isAbstract);
70 } 68 }
71 69
70
72 class S {} 71 class S {}
73
74 abstract class M { 72 abstract class M {
75 mixinFoo(); 73 mixinFoo();
76 } 74 }
77 75 abstract class MA extends S with M {
78 abstract class MA extends S with M {} 76 }
79
80 class SubMA extends MA { 77 class SubMA extends MA {
81 mixinFoo() {} 78 mixinFoo() {}
82 } 79 }
83
84 class ConcreteMA extends S with M { 80 class ConcreteMA extends S with M {
85 mixinFoo() {} 81 mixinFoo() {}
86 } 82 }
87 83
88 class M2 { 84 class M2 {
89 mixin2Foo() {} 85 mixin2Foo() {}
90 } 86 }
91
92 abstract class MA2 extends S with M2 { 87 abstract class MA2 extends S with M2 {
93 mixinBar(); 88 mixinBar();
94 } 89 }
95
96 class SubMA2 extends MA2 { 90 class SubMA2 extends MA2 {
97 mixinBar() {} 91 mixinBar() {}
98 } 92 }
99
100 class ConcreteMA2 extends S with M2 { 93 class ConcreteMA2 extends S with M2 {
101 mixin2Foo() {} 94 mixin2Foo() {}
102 } 95 }
103 96
104 testAnonMixinApplication() { 97 testAnonMixinApplication() {
105 // Application is abstract. 98 // Application is abstract.
106 { 99 {
107 // Mixin is abstract. 100 // Mixin is abstract.
108 Expect.isFalse(reflectClass(SubMA).isAbstract); 101 Expect.isFalse(reflectClass(SubMA).isAbstract);
109 Expect.isTrue(reflectClass(SubMA).superclass.isAbstract); 102 Expect.isTrue(reflectClass(SubMA).superclass.isAbstract);
110 Expect.isFalse(reflectClass(SubMA).superclass.superclass.isAbstract); 103 Expect.isFalse(reflectClass(SubMA).superclass.superclass.isAbstract);
111 Expect.isTrue(reflectClass(MA).isAbstract); 104 Expect.isTrue(reflectClass(MA).isAbstract);
112 Expect.isFalse(reflectClass(MA).superclass.isAbstract); 105 Expect.isFalse(reflectClass(MA).superclass.isAbstract);
113 106
114 // Mixin is concrete. 107 // Mixin is concrete.
115 Expect.isFalse(reflectClass(SubMA2).isAbstract); 108 Expect.isFalse(reflectClass(SubMA2).isAbstract);
116 Expect.isTrue(reflectClass(SubMA2).superclass.isAbstract); 109 Expect.isTrue(reflectClass(SubMA2).superclass.isAbstract);
117 Expect.isFalse(reflectClass(SubMA2).superclass.superclass.isAbstract); 110 Expect.isFalse(reflectClass(SubMA2).superclass.superclass.isAbstract);
118 Expect.isTrue(reflectClass(MA2).isAbstract); 111 Expect.isTrue(reflectClass(MA2).isAbstract);
119 Expect.isFalse(reflectClass(MA2).superclass.isAbstract); 112 Expect.isFalse(reflectClass(MA2).superclass.isAbstract);
120 } 113 }
121 114
122 // Application is concrete. 115 // Application is concrete.
123 { 116 {
124 // Mixin is abstract. 117 // Mixin is abstract.
125 Expect.isFalse(reflectClass(ConcreteMA).isAbstract); 118 Expect.isFalse(reflectClass(ConcreteMA).isAbstract);
126 Expect.isFalse(reflectClass(ConcreteMA).superclass.isAbstract); 119 Expect.isFalse(reflectClass(ConcreteMA).superclass.isAbstract);
127 Expect.isFalse(reflectClass(ConcreteMA).superclass.superclass.isAbstract); 120 Expect.isFalse(reflectClass(ConcreteMA).superclass.superclass.isAbstract);
128 121
129 // Mixin is concrete. 122 // Mixin is concrete.
130 Expect.isFalse(reflectClass(ConcreteMA2).isAbstract); 123 Expect.isFalse(reflectClass(ConcreteMA2).isAbstract);
131 Expect.isFalse(reflectClass(ConcreteMA2).superclass.isAbstract); 124 Expect.isFalse(reflectClass(ConcreteMA2).superclass.isAbstract);
132 Expect.isFalse(reflectClass(ConcreteMA2).superclass.superclass.isAbstract); 125 Expect.isFalse(reflectClass(ConcreteMA2).superclass.superclass.isAbstract);
133 } 126 }
134 } 127 }
135 128
136 abstract class NamedMA = S with M; 129 abstract class NamedMA = S with M;
137
138 class SubNamedMA extends NamedMA { 130 class SubNamedMA extends NamedMA {
139 mixinFoo() {} 131 mixinFoo() {}
140 } 132 }
141 class ConcreteNamedMA = S with M; //# 00: static type warning 133 class ConcreteNamedMA = S with M; //# 00: static type warning
142 134
143 abstract class NamedMA2 = S with M2; 135 abstract class NamedMA2 = S with M2;
144
145 class SubNamedMA2 extends NamedMA2 { 136 class SubNamedMA2 extends NamedMA2 {
146 mixinFoo() {} 137 mixinFoo() {}
147 } 138 }
148
149 class ConcreteNamedMA2 = S with M2; 139 class ConcreteNamedMA2 = S with M2;
150 140
151 testNamedMixinApplication() { 141 testNamedMixinApplication() {
152 // Application is abstract. 142 // Application is abstract.
153 { 143 {
154 // Mixin is abstract. 144 // Mixin is abstract.
155 Expect.isFalse(reflectClass(SubNamedMA).isAbstract); 145 Expect.isFalse(reflectClass(SubNamedMA).isAbstract);
156 Expect.isTrue(reflectClass(SubNamedMA).superclass.isAbstract); 146 Expect.isTrue(reflectClass(SubNamedMA).superclass.isAbstract);
157 Expect.isFalse(reflectClass(SubNamedMA).superclass.superclass.isAbstract); 147 Expect.isFalse(reflectClass(SubNamedMA).superclass.superclass.isAbstract);
158 Expect.isTrue(reflectClass(NamedMA).isAbstract); 148 Expect.isTrue(reflectClass(NamedMA).isAbstract);
159 Expect.isFalse(reflectClass(NamedMA).superclass.isAbstract); 149 Expect.isFalse(reflectClass(NamedMA).superclass.isAbstract);
160 150
161 // Mixin is concrete. 151 // Mixin is concrete.
162 Expect.isFalse(reflectClass(SubNamedMA2).isAbstract); 152 Expect.isFalse(reflectClass(SubNamedMA2).isAbstract);
163 Expect.isTrue(reflectClass(SubNamedMA2).superclass.isAbstract); 153 Expect.isTrue(reflectClass(SubNamedMA2).superclass.isAbstract);
164 Expect.isFalse(reflectClass(SubNamedMA2).superclass.superclass.isAbstract); 154 Expect.isFalse(reflectClass(SubNamedMA2).superclass.superclass.isAbstract);
165 Expect.isTrue(reflectClass(NamedMA2).isAbstract); 155 Expect.isTrue(reflectClass(NamedMA2).isAbstract);
166 Expect.isFalse(reflectClass(NamedMA2).superclass.isAbstract); 156 Expect.isFalse(reflectClass(NamedMA2).superclass.isAbstract);
167 } 157 }
168 158
169 // Application is concrete. 159 // Application is concrete.
170 { 160 {
171 // Mixin is abstract. 161 // Mixin is abstract.
172 Expect.isFalse(reflectClass(ConcreteNamedMA).isAbstract); //# 00: ok 162 Expect.isFalse(reflectClass(ConcreteNamedMA).isAbstract); //# 00: ok
173 Expect.isFalse(reflectClass(ConcreteNamedMA).superclass.isAbstract); //# 00: o k 163 Expect.isFalse(reflectClass(ConcreteNamedMA).superclass.isAbstract); //# 00: o k
174 164
175 // Mixin is concrete. 165 // Mixin is concrete.
176 Expect.isFalse(reflectClass(ConcreteNamedMA2).isAbstract); 166 Expect.isFalse(reflectClass(ConcreteNamedMA2).isAbstract);
177 Expect.isFalse(reflectClass(ConcreteNamedMA2).superclass.isAbstract); 167 Expect.isFalse(reflectClass(ConcreteNamedMA2).superclass.isAbstract);
178 } 168 }
179 } 169 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698