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

Side by Side Diff: tests/lib/mirrors/constructor_kinds_test.dart

Issue 64793003: Update mirror tests for removed API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 7 years, 1 month 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
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 test.constructor_kinds_test; 5 library test.constructor_kinds_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 class ClassWithDefaultConstructor {} 10 class ClassWithDefaultConstructor {}
(...skipping 24 matching lines...) Expand all
35 new ClassWithDefaultConstructor(); /// 01: ok 35 new ClassWithDefaultConstructor(); /// 01: ok
36 new Class.generativeConstructor(); /// 01: ok 36 new Class.generativeConstructor(); /// 01: ok
37 new Class.redirectingGenerativeConstructor(); /// 01: ok 37 new Class.redirectingGenerativeConstructor(); /// 01: ok
38 new Class.factoryConstructor(); /// 01: ok 38 new Class.factoryConstructor(); /// 01: ok
39 new Class.redirectingFactoryConstructor(); /// 01: ok 39 new Class.redirectingFactoryConstructor(); /// 01: ok
40 const Class.constGenerativeConstructor(); /// 01: ok 40 const Class.constGenerativeConstructor(); /// 01: ok
41 const Class.constRedirectingGenerativeConstructor(); /// 01: ok 41 const Class.constRedirectingGenerativeConstructor(); /// 01: ok
42 const Class.constRedirectingFactoryConstructor(); /// 01: ok 42 const Class.constRedirectingFactoryConstructor(); /// 01: ok
43 43
44 cm = reflectClass(ClassWithDefaultConstructor); 44 cm = reflectClass(ClassWithDefaultConstructor);
45 mm = cm.constructors.values.single; 45 mm = cm.declarations.values
46 .where((d) => d is MethodMirror && d.isConstructor).single;
46 Expect.isTrue(mm.isConstructor); 47 Expect.isTrue(mm.isConstructor);
47 Expect.isTrue(mm.isGenerativeConstructor); 48 Expect.isTrue(mm.isGenerativeConstructor);
48 Expect.isFalse(mm.isFactoryConstructor); 49 Expect.isFalse(mm.isFactoryConstructor);
49 Expect.isFalse(mm.isRedirectingConstructor); 50 Expect.isFalse(mm.isRedirectingConstructor);
50 Expect.isFalse(mm.isConstConstructor); 51 Expect.isFalse(mm.isConstConstructor);
51 52
52 cm = reflectClass(Class); 53 cm = reflectClass(Class);
53 54
54 mm = cm.constructors[#Class.generativeConstructor]; 55 mm = cm.declarations[#Class.generativeConstructor];
55 Expect.isTrue(mm.isConstructor); 56 Expect.isTrue(mm.isConstructor);
56 Expect.isTrue(mm.isGenerativeConstructor); 57 Expect.isTrue(mm.isGenerativeConstructor);
57 Expect.isFalse(mm.isFactoryConstructor); 58 Expect.isFalse(mm.isFactoryConstructor);
58 Expect.isFalse(mm.isRedirectingConstructor); 59 Expect.isFalse(mm.isRedirectingConstructor);
59 Expect.isFalse(mm.isConstConstructor); 60 Expect.isFalse(mm.isConstConstructor);
60 61
61 mm = cm.constructors[#Class.redirectingGenerativeConstructor]; 62 mm = cm.declarations[#Class.redirectingGenerativeConstructor];
62 Expect.isTrue(mm.isConstructor); 63 Expect.isTrue(mm.isConstructor);
63 Expect.isTrue(mm.isGenerativeConstructor); 64 Expect.isTrue(mm.isGenerativeConstructor);
64 Expect.isFalse(mm.isFactoryConstructor); 65 Expect.isFalse(mm.isFactoryConstructor);
65 Expect.isTrue(mm.isRedirectingConstructor); 66 Expect.isTrue(mm.isRedirectingConstructor);
66 Expect.isFalse(mm.isConstConstructor); 67 Expect.isFalse(mm.isConstConstructor);
67 68
68 mm = cm.constructors[#Class.factoryConstructor]; 69 mm = cm.declarations[#Class.factoryConstructor];
69 Expect.isTrue(mm.isConstructor); 70 Expect.isTrue(mm.isConstructor);
70 Expect.isFalse(mm.isGenerativeConstructor); 71 Expect.isFalse(mm.isGenerativeConstructor);
71 Expect.isTrue(mm.isFactoryConstructor); 72 Expect.isTrue(mm.isFactoryConstructor);
72 Expect.isFalse(mm.isRedirectingConstructor); 73 Expect.isFalse(mm.isRedirectingConstructor);
73 Expect.isFalse(mm.isConstConstructor); 74 Expect.isFalse(mm.isConstConstructor);
74 75
75 mm = cm.constructors[#Class.redirectingFactoryConstructor]; 76 mm = cm.declarations[#Class.redirectingFactoryConstructor];
76 Expect.isTrue(mm.isConstructor); 77 Expect.isTrue(mm.isConstructor);
77 Expect.isFalse(mm.isGenerativeConstructor); 78 Expect.isFalse(mm.isGenerativeConstructor);
78 Expect.isTrue(mm.isFactoryConstructor); 79 Expect.isTrue(mm.isFactoryConstructor);
79 Expect.isTrue(mm.isRedirectingConstructor); 80 Expect.isTrue(mm.isRedirectingConstructor);
80 Expect.isFalse(mm.isConstConstructor); 81 Expect.isFalse(mm.isConstConstructor);
81 82
82 mm = cm.constructors[#Class.constGenerativeConstructor]; 83 mm = cm.declarations[#Class.constGenerativeConstructor];
83 Expect.isTrue(mm.isConstructor); 84 Expect.isTrue(mm.isConstructor);
84 Expect.isTrue(mm.isGenerativeConstructor); 85 Expect.isTrue(mm.isGenerativeConstructor);
85 Expect.isFalse(mm.isFactoryConstructor); 86 Expect.isFalse(mm.isFactoryConstructor);
86 Expect.isFalse(mm.isRedirectingConstructor); 87 Expect.isFalse(mm.isRedirectingConstructor);
87 Expect.isTrue(mm.isConstConstructor); 88 Expect.isTrue(mm.isConstConstructor);
88 89
89 mm = cm.constructors[#Class.constRedirectingGenerativeConstructor]; 90 mm = cm.declarations[#Class.constRedirectingGenerativeConstructor];
90 Expect.isTrue(mm.isConstructor); 91 Expect.isTrue(mm.isConstructor);
91 Expect.isTrue(mm.isGenerativeConstructor); 92 Expect.isTrue(mm.isGenerativeConstructor);
92 Expect.isFalse(mm.isFactoryConstructor); 93 Expect.isFalse(mm.isFactoryConstructor);
93 Expect.isTrue(mm.isRedirectingConstructor); 94 Expect.isTrue(mm.isRedirectingConstructor);
94 Expect.isTrue(mm.isConstConstructor); 95 Expect.isTrue(mm.isConstConstructor);
95 96
96 // Not legal. 97 // Not legal.
97 // mm = cm.constructors[#Class.constFactoryConstructor]; 98 // mm = cm.declarations[#Class.constFactoryConstructor];
98 // Expect.isTrue(mm.isConstructor); 99 // Expect.isTrue(mm.isConstructor);
99 // Expect.isFalse(mm.isGenerativeConstructor); 100 // Expect.isFalse(mm.isGenerativeConstructor);
100 // Expect.isTrue(mm.isFactoryConstructor); 101 // Expect.isTrue(mm.isFactoryConstructor);
101 // Expect.isFalse(mm.isRedirectingConstructor); 102 // Expect.isFalse(mm.isRedirectingConstructor);
102 // Expect.isTrue(mm.isConstConstructor); 103 // Expect.isTrue(mm.isConstConstructor);
103 104
104 mm = cm.constructors[#Class.constRedirectingFactoryConstructor]; 105 mm = cm.declarations[#Class.constRedirectingFactoryConstructor];
105 Expect.isTrue(mm.isConstructor); 106 Expect.isTrue(mm.isConstructor);
106 Expect.isFalse(mm.isGenerativeConstructor); 107 Expect.isFalse(mm.isGenerativeConstructor);
107 Expect.isTrue(mm.isFactoryConstructor); 108 Expect.isTrue(mm.isFactoryConstructor);
108 Expect.isTrue(mm.isRedirectingConstructor); 109 Expect.isTrue(mm.isRedirectingConstructor);
109 Expect.isTrue(mm.isConstConstructor); 110 Expect.isTrue(mm.isConstConstructor);
110 } 111 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/basic_types_in_dart_core_test.dart ('k') | tests/lib/mirrors/constructors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698