| OLD | NEW |
| 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 throw error on identical keys', () { | 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) |
| 11 ..type(A2); | 11 ..type(A2); |
| 12 | 12 |
| 13 var injector = new DynamicInjector(modules: [module]); | 13 var injector = new DynamicInjector(modules: [module]); |
| 14 expect(() { | 14 expect(() { |
| 15 injector.get(MyMap); | 15 injector.get(MyMap); |
| 16 }).toThrow("Duplicate annotation found: MyAnnotation: A. Exisitng:"); | 16 }).not.toThrow(); |
| 17 }); | 17 }); |
| 18 | 18 |
| 19 it('should iterate over all types', () { | 19 it('should iterate over all types', () { |
| 20 var module = new Module() | 20 var module = new Module() |
| 21 ..type(MyMap) | 21 ..type(MyMap) |
| 22 ..type(MetadataExtractor) | 22 ..type(MetadataExtractor) |
| 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 = []; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 | 43 |
| 44 const MyAnnotation(String this.name); | 44 const MyAnnotation(String this.name); |
| 45 | 45 |
| 46 toString() => name; | 46 toString() => name; |
| 47 get hashCode => name.hashCode; | 47 get hashCode => name.hashCode; |
| 48 operator==(other) => this.name == other.name; | 48 operator==(other) => this.name == other.name; |
| 49 } | 49 } |
| 50 | 50 |
| 51 @MyAnnotation('A') @MyAnnotation('B') class A1 {} | 51 @MyAnnotation('A') @MyAnnotation('B') class A1 {} |
| 52 @MyAnnotation('A') class A2 {} | 52 @MyAnnotation('A') class A2 {} |
| OLD | NEW |