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

Side by Side Diff: pkg/smoke/test/common.dart

Issue 180273004: Fixes in smoke, which in turn should fix todomvc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « pkg/smoke/lib/static.dart ('k') | pkg/smoke/test/static_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// Common test code that is run by 3 tests: mirrors_test.dart, 5 /// Common test code that is run by 3 tests: mirrors_test.dart,
6 /// mirrors_used_test.dart, and static_test.dart. 6 /// mirrors_used_test.dart, and static_test.dart.
7 library smoke.test.common; 7 library smoke.test.common;
8 8
9 import 'package:smoke/smoke.dart' as smoke; 9 import 'package:smoke/smoke.dart' as smoke;
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 expect(d.name, #d); 192 expect(d.name, #d);
193 expect(d.isField, isTrue); 193 expect(d.isField, isTrue);
194 expect(d.isProperty, isFalse); 194 expect(d.isProperty, isFalse);
195 expect(d.isMethod, isFalse); 195 expect(d.isMethod, isFalse);
196 expect(d.isFinal, isFalse); 196 expect(d.isFinal, isFalse);
197 expect(d.isStatic, isFalse); 197 expect(d.isStatic, isFalse);
198 expect(d.annotations, [32]); 198 expect(d.annotations, [32]);
199 expect(d.type, int); 199 expect(d.type, int);
200 }); 200 });
201 201
202 test('isSuperclass', () {
203 expect(smoke.isSubclassOf(D, C), isTrue);
204 expect(smoke.isSubclassOf(H, G), isTrue);
205 expect(smoke.isSubclassOf(H, H), isTrue);
206 expect(smoke.isSubclassOf(H, Object), isTrue);
207 expect(smoke.isSubclassOf(B, Object), isTrue);
208 expect(smoke.isSubclassOf(A, Object), isTrue);
209 expect(smoke.isSubclassOf(AnnotB, Annot), isTrue);
210
211 expect(smoke.isSubclassOf(D, A), isFalse);
212 expect(smoke.isSubclassOf(H, B), isFalse);
213 expect(smoke.isSubclassOf(B, A), isFalse);
214 expect(smoke.isSubclassOf(Object, A), isFalse);
215 });
216
202 group('query', () { 217 group('query', () {
203 test('default', () { 218 test('default', () {
204 var options = new smoke.QueryOptions(); 219 var options = new smoke.QueryOptions();
205 var res = smoke.query(A, options); 220 var res = smoke.query(A, options);
206 expect(res.map((e) => e.name), [#i, #j, #j2]); 221 expect(res.map((e) => e.name), [#i, #j, #j2]);
207 }); 222 });
208 223
209 test('only fields', () { 224 test('only fields', () {
210 var options = new smoke.QueryOptions(includeProperties: false); 225 var options = new smoke.QueryOptions(includeProperties: false);
211 var res = smoke.query(A, options); 226 var res = smoke.query(A, options);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 options = new smoke.QueryOptions(includeInherited: true, 266 options = new smoke.QueryOptions(includeInherited: true,
252 withAnnotations: const [a1, a2]); 267 withAnnotations: const [a1, a2]);
253 res = smoke.query(H, options); 268 res = smoke.query(H, options);
254 expect(res.map((e) => e.name), [#b, #d, #f, #g, #h]); 269 expect(res.map((e) => e.name), [#b, #d, #f, #g, #h]);
255 }); 270 });
256 271
257 test('type annotation', () { 272 test('type annotation', () {
258 var options = new smoke.QueryOptions(includeInherited: true, 273 var options = new smoke.QueryOptions(includeInherited: true,
259 withAnnotations: const [Annot]); 274 withAnnotations: const [Annot]);
260 var res = smoke.query(H, options); 275 var res = smoke.query(H, options);
261 expect(res.map((e) => e.name), [#b, #f, #g]); 276 expect(res.map((e) => e.name), [#b, #f, #g, #i]);
262 }); 277 });
263 278
264 test('mixed annotations (type and exact)', () { 279 test('mixed annotations (type and exact)', () {
265 var options = new smoke.QueryOptions(includeInherited: true, 280 var options = new smoke.QueryOptions(includeInherited: true,
266 withAnnotations: const [a2, Annot]); 281 withAnnotations: const [a2, Annot]);
267 var res = smoke.query(H, options); 282 var res = smoke.query(H, options);
268 expect(res.map((e) => e.name), [#b, #d, #f, #g, #h]); 283 expect(res.map((e) => e.name), [#b, #d, #f, #g, #h, #i]);
269 }); 284 });
270 285
271 test('symbol to name', () { 286 test('symbol to name', () {
272 expect(smoke.symbolToName(#i), 'i'); 287 expect(smoke.symbolToName(#i), 'i');
273 }); 288 });
274 289
275 test('name to symbol', () { 290 test('name to symbol', () {
276 expect(smoke.nameToSymbol('i'), #i); 291 expect(smoke.nameToSymbol('i'), #i);
277 }); 292 });
278 }); 293 });
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 347
333 class E2 extends E {} 348 class E2 extends E {}
334 349
335 class F { 350 class F {
336 static int staticMethod(A a) => a.i; 351 static int staticMethod(A a) => a.i;
337 } 352 }
338 353
339 class F2 extends F {} 354 class F2 extends F {}
340 355
341 class Annot { const Annot(); } 356 class Annot { const Annot(); }
357 class AnnotB extends Annot { const AnnotB(); }
342 const a1 = const Annot(); 358 const a1 = const Annot();
343 const a2 = 32; 359 const a2 = 32;
360 const a3 = const AnnotB();
344 361
345 362
346 class G { 363 class G {
347 int a; 364 int a;
348 @a1 int b; 365 @a1 int b;
349 int c; 366 int c;
350 @a2 int d; 367 @a2 int d;
351 } 368 }
352 369
353 class H extends G { 370 class H extends G {
354 int e; 371 int e;
355 @a1 int f; 372 @a1 int f;
356 @a1 int g; 373 @a1 int g;
357 @a2 int h; 374 @a2 int h;
375 @a3 int i;
358 } 376 }
OLDNEW
« no previous file with comments | « pkg/smoke/lib/static.dart ('k') | pkg/smoke/test/static_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698