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

Side by Side Diff: tests/compiler/dart2js/mirrors_test.dart

Issue 11341037: Rename InterfaceMirror to ClassMirror (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart ('k') | utils/apidoc/apidoc.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #import("../../../pkg/dartdoc/lib/mirrors.dart"); 5 #import("../../../pkg/dartdoc/lib/mirrors.dart");
6 #import("../../../pkg/dartdoc/lib/mirrors_util.dart"); 6 #import("../../../pkg/dartdoc/lib/mirrors_util.dart");
7 7
8 #import('dart:io'); 8 #import('dart:io');
9 9
10 int count(Iterable iterable) { 10 int count(Iterable iterable) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Testing class Foo: 72 // Testing class Foo:
73 // 73 //
74 // class Foo { 74 // class Foo {
75 // 75 //
76 // } 76 // }
77 void testFoo(MirrorSystem system, LibraryMirror helperLibrary, 77 void testFoo(MirrorSystem system, LibraryMirror helperLibrary,
78 Map<String,TypeMirror> types) { 78 Map<String,TypeMirror> types) {
79 var fooClass = types["Foo"]; 79 var fooClass = types["Foo"];
80 Expect.isNotNull(fooClass, "Type 'Foo' not found"); 80 Expect.isNotNull(fooClass, "Type 'Foo' not found");
81 Expect.isTrue(fooClass is InterfaceMirror, 81 Expect.isTrue(fooClass is ClassMirror,
82 "Unexpected mirror type returned"); 82 "Unexpected mirror type returned");
83 Expect.stringEquals("Foo", fooClass.simpleName, 83 Expect.stringEquals("Foo", fooClass.simpleName,
84 "Unexpected type simple name"); 84 "Unexpected type simple name");
85 Expect.stringEquals("mirrors_helper.Foo", fooClass.qualifiedName, 85 Expect.stringEquals("mirrors_helper.Foo", fooClass.qualifiedName,
86 "Unexpected type qualified name"); 86 "Unexpected type qualified name");
87 87
88 Expect.equals(helperLibrary, fooClass.library, 88 Expect.equals(helperLibrary, fooClass.library,
89 "Unexpected library returned from type"); 89 "Unexpected library returned from type");
90 90
91 Expect.isFalse(fooClass.isObject, "Class is Object"); 91 Expect.isFalse(fooClass.isObject, "Class is Object");
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 // Testing interface Bar: 145 // Testing interface Bar:
146 // 146 //
147 // interface Bar<E> { 147 // interface Bar<E> {
148 // 148 //
149 // } 149 // }
150 void testBar(MirrorSystem system, LibraryMirror helperLibrary, 150 void testBar(MirrorSystem system, LibraryMirror helperLibrary,
151 Map<String,TypeMirror> types) { 151 Map<String,TypeMirror> types) {
152 var barInterface = types["Bar"]; 152 var barInterface = types["Bar"];
153 Expect.isNotNull(barInterface, "Type 'Bar' not found"); 153 Expect.isNotNull(barInterface, "Type 'Bar' not found");
154 Expect.isTrue(barInterface is InterfaceMirror, 154 Expect.isTrue(barInterface is ClassMirror,
155 "Unexpected mirror type returned"); 155 "Unexpected mirror type returned");
156 Expect.stringEquals("Bar", barInterface.simpleName, 156 Expect.stringEquals("Bar", barInterface.simpleName,
157 "Unexpected type simple name"); 157 "Unexpected type simple name");
158 Expect.stringEquals("mirrors_helper.Bar", barInterface.qualifiedName, 158 Expect.stringEquals("mirrors_helper.Bar", barInterface.qualifiedName,
159 "Unexpected type qualified name"); 159 "Unexpected type qualified name");
160 160
161 Expect.equals(helperLibrary, barInterface.library, 161 Expect.equals(helperLibrary, barInterface.library,
162 "Unexpected library returned from type"); 162 "Unexpected library returned from type");
163 163
164 Expect.isFalse(barInterface.isObject, "Interface is Object"); 164 Expect.isFalse(barInterface.isObject, "Interface is Object");
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // void method2(E e, [F f = null]) {} 234 // void method2(E e, [F f = null]) {}
235 // Baz<E,F> method3(E func1(F f), Func<E,F> func2) => null; 235 // Baz<E,F> method3(E func1(F f), Func<E,F> func2) => null;
236 // 236 //
237 // bool operator==(Object other) => false; 237 // bool operator==(Object other) => false;
238 // int operator -() => 0; 238 // int operator -() => 0;
239 // } 239 // }
240 void testBaz(MirrorSystem system, LibraryMirror helperLibrary, 240 void testBaz(MirrorSystem system, LibraryMirror helperLibrary,
241 Map<String,TypeMirror> types) { 241 Map<String,TypeMirror> types) {
242 var bazClass = types["Baz"]; 242 var bazClass = types["Baz"];
243 Expect.isNotNull(bazClass, "Type 'Baz' not found"); 243 Expect.isNotNull(bazClass, "Type 'Baz' not found");
244 Expect.isTrue(bazClass is InterfaceMirror, 244 Expect.isTrue(bazClass is ClassMirror,
245 "Unexpected mirror type returned"); 245 "Unexpected mirror type returned");
246 Expect.stringEquals("Baz", bazClass.simpleName, 246 Expect.stringEquals("Baz", bazClass.simpleName,
247 "Unexpected type simple name"); 247 "Unexpected type simple name");
248 Expect.stringEquals("mirrors_helper.Baz", bazClass.qualifiedName, 248 Expect.stringEquals("mirrors_helper.Baz", bazClass.qualifiedName,
249 "Unexpected type qualified name"); 249 "Unexpected type qualified name");
250 250
251 Expect.equals(helperLibrary, bazClass.library, 251 Expect.equals(helperLibrary, bazClass.library,
252 "Unexpected library returned from type"); 252 "Unexpected library returned from type");
253 253
254 Expect.isFalse(bazClass.isObject, "Class is Object"); 254 Expect.isFalse(bazClass.isObject, "Class is Object");
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 Expect.isNull(method3.constructorName, 477 Expect.isNull(method3.constructorName,
478 "Method constructorName is non-null"); 478 "Method constructorName is non-null");
479 Expect.isFalse(method3.isGetter, "Method is getter"); 479 Expect.isFalse(method3.isGetter, "Method is getter");
480 Expect.isFalse(method3.isSetter, "Method is setter"); 480 Expect.isFalse(method3.isSetter, "Method is setter");
481 Expect.isFalse(method3.isOperator, "Method is operator"); 481 Expect.isFalse(method3.isOperator, "Method is operator");
482 Expect.isNull(method3.operatorName, 482 Expect.isNull(method3.operatorName,
483 "Method operatorName is non-null"); 483 "Method operatorName is non-null");
484 484
485 var method3ReturnType = method3.returnType; 485 var method3ReturnType = method3.returnType;
486 Expect.isNotNull(method3ReturnType, "Return type is null"); 486 Expect.isNotNull(method3ReturnType, "Return type is null");
487 Expect.isTrue(method3ReturnType is InterfaceMirror, 487 Expect.isTrue(method3ReturnType is ClassMirror,
488 "Return type is not interface"); 488 "Return type is not interface");
489 Expect.equals(bazClass, method3ReturnType.declaration, 489 Expect.equals(bazClass, method3ReturnType.declaration,
490 "Return type is not Baz"); 490 "Return type is not Baz");
491 // TODO(johnniwinther): Test type arguments of [method3ReturnType]. 491 // TODO(johnniwinther): Test type arguments of [method3ReturnType].
492 492
493 var method3Parameters = method3.parameters; 493 var method3Parameters = method3.parameters;
494 Expect.isNotNull(method3Parameters, "Method parameters is null"); 494 Expect.isNotNull(method3Parameters, "Method parameters is null");
495 Expect.equals(2, method3Parameters.length, "Unexpected parameter count"); 495 Expect.equals(2, method3Parameters.length, "Unexpected parameter count");
496 var method3Parameter1 = method3Parameters[0]; 496 var method3Parameter1 = method3Parameters[0];
497 Expect.isNotNull(method3Parameter1, "Parameter is null"); 497 Expect.isNotNull(method3Parameter1, "Parameter is null");
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 // get _privateGetter => _privateField; 692 // get _privateGetter => _privateField;
693 // void set _privateSetter(value) => _privateField = value; 693 // void set _privateSetter(value) => _privateField = value;
694 // void _privateMethod() {} 694 // void _privateMethod() {}
695 // _PrivateClass._privateConstructor(); 695 // _PrivateClass._privateConstructor();
696 // factory _PrivateClass._privateFactoryConstructor() => new _PrivateClass(); 696 // factory _PrivateClass._privateFactoryConstructor() => new _PrivateClass();
697 // } 697 // }
698 void testPrivate(MirrorSystem system, LibraryMirror helperLibrary, 698 void testPrivate(MirrorSystem system, LibraryMirror helperLibrary,
699 Map<String,TypeMirror> types) { 699 Map<String,TypeMirror> types) {
700 var privateClass = types['_PrivateClass']; 700 var privateClass = types['_PrivateClass'];
701 Expect.isNotNull(privateClass); 701 Expect.isNotNull(privateClass);
702 Expect.isTrue(privateClass is InterfaceMirror); 702 Expect.isTrue(privateClass is ClassMirror);
703 Expect.isTrue(privateClass.isClass); 703 Expect.isTrue(privateClass.isClass);
704 Expect.isTrue(privateClass.isPrivate); 704 Expect.isTrue(privateClass.isPrivate);
705 705
706 var privateField = privateClass.declaredMembers['_privateField']; 706 var privateField = privateClass.declaredMembers['_privateField'];
707 Expect.isNotNull(privateField); 707 Expect.isNotNull(privateField);
708 Expect.isTrue(privateField is FieldMirror); 708 Expect.isTrue(privateField is FieldMirror);
709 Expect.isTrue(privateField.isPrivate); 709 Expect.isTrue(privateField.isPrivate);
710 710
711 var privateGetter = privateClass.declaredMembers['_privateGetter']; 711 var privateGetter = privateClass.declaredMembers['_privateGetter'];
712 Expect.isNotNull(privateGetter); 712 Expect.isNotNull(privateGetter);
(...skipping 19 matching lines...) Expand all
732 Expect.isTrue(privateConstructor.isConstructor); 732 Expect.isTrue(privateConstructor.isConstructor);
733 Expect.isTrue(privateConstructor.isPrivate); 733 Expect.isTrue(privateConstructor.isPrivate);
734 734
735 var privateFactoryConstructor = 735 var privateFactoryConstructor =
736 privateClass.declaredMembers['_PrivateClass._privateFactoryConstructor']; 736 privateClass.declaredMembers['_PrivateClass._privateFactoryConstructor'];
737 Expect.isNotNull(privateFactoryConstructor); 737 Expect.isNotNull(privateFactoryConstructor);
738 Expect.isTrue(privateFactoryConstructor is MethodMirror); 738 Expect.isTrue(privateFactoryConstructor is MethodMirror);
739 Expect.isTrue(privateFactoryConstructor.isFactory); 739 Expect.isTrue(privateFactoryConstructor.isFactory);
740 Expect.isTrue(privateFactoryConstructor.isPrivate); 740 Expect.isTrue(privateFactoryConstructor.isPrivate);
741 } 741 }
OLDNEW
« no previous file with comments | « pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart ('k') | utils/apidoc/apidoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698