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

Side by Side Diff: third_party/pkg/angular/test/core/registry_spec.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://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
OLDNEW
1 library registry_spec; 1 library registry_spec;
2 2
3 import '../_specs.dart'; 3 import '../_specs.dart';
4 4
5 main() => describe('RegistryMap', () { 5 main() => describe('RegistryMap', () {
6 it('should allow for multiple registry keys to be added', () { 6 it('should allow for multiple registry keys to be added', () {
7 var module = new Module() 7 var module = new Module()
8 ..type(MyMap) 8 ..type(MyMap)
9 ..type(MetadataExtractor) 9 ..type(MetadataExtractor)
10 ..type(A1) 10 ..type(A1)
(...skipping 12 matching lines...) Expand all
23 ..type(A1); 23 ..type(A1);
24 24
25 var injector = new DynamicInjector(modules: [module]); 25 var injector = new DynamicInjector(modules: [module]);
26 var keys = []; 26 var keys = [];
27 var types = []; 27 var types = [];
28 var map = injector.get(MyMap); 28 var map = injector.get(MyMap);
29 map.forEach((k, t) { keys.add(k); types.add(t); }); 29 map.forEach((k, t) { keys.add(k); types.add(t); });
30 expect(keys).toEqual([new MyAnnotation('A'), new MyAnnotation('B')]); 30 expect(keys).toEqual([new MyAnnotation('A'), new MyAnnotation('B')]);
31 expect(types).toEqual([A1, A1]); 31 expect(types).toEqual([A1, A1]);
32 }); 32 });
33
34 it('should safely ignore typedefs', () {
35 var module = new Module()
36 ..type(MyMap)
37 ..type(MetadataExtractor)
38 ..value(MyTypedef, (String _) => null);
39
40 var injector = new DynamicInjector(modules: [module]);
41 expect(() => injector.get(MyMap), isNot(throws));
42 });
43 }); 33 });
44 34
45 typedef void MyTypedef(String arg);
46
47 class MyMap extends AnnotationMap<MyAnnotation> { 35 class MyMap extends AnnotationMap<MyAnnotation> {
48 MyMap(Injector injector, MetadataExtractor metadataExtractor) 36 MyMap(Injector injector, MetadataExtractor metadataExtractor)
49 : super(injector, metadataExtractor); 37 : super(injector, metadataExtractor);
50 } 38 }
51 39
52 40
53 class MyAnnotation { 41 class MyAnnotation {
54 final String name; 42 final String name;
55 43
56 const MyAnnotation(String this.name); 44 const MyAnnotation(String this.name);
57 45
58 toString() => name; 46 toString() => name;
59 get hashCode => name.hashCode; 47 get hashCode => name.hashCode;
60 operator==(other) => this.name == other.name; 48 operator==(other) => this.name == other.name;
61 } 49 }
62 50
63 @MyAnnotation('A') @MyAnnotation('B') class A1 {} 51 @MyAnnotation('A') @MyAnnotation('B') class A1 {}
64 @MyAnnotation('A') class A2 {} 52 @MyAnnotation('A') class A2 {}
OLDNEW
« no previous file with comments | « third_party/pkg/angular/test/core/parser/static_parser_spec.dart ('k') | third_party/pkg/angular/test/core/scope_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698