| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import 'dart:async'; | |
| 6 | |
| 7 import 'dart:mirrors'; | |
| 8 | |
| 9 import 'package:unittest/unittest.dart'; | |
| 10 import 'package:unittest/html_config.dart'; | |
| 11 | |
| 12 import 'package:polymer/src/mirror_loader.dart'; | |
| 13 /// prevent unused import warnings: [m1.XA] [m2.XA] [m3.XB] [m4.XA]. | |
| 14 import 'mirror_loader_1.dart' as m1; | |
| 15 import 'mirror_loader_2.dart' as m2; | |
| 16 import 'mirror_loader_3.dart' as m3; | |
| 17 import 'mirror_loader_4.dart' as m4; | |
| 18 | |
| 19 main() { | |
| 20 useHtmlConfiguration(); | |
| 21 | |
| 22 test('registered correctly', () { | |
| 23 expect(_discover(#mirror_loader_test1).length, 1); | |
| 24 expect(_discover(#mirror_loader_test2).length, 1); | |
| 25 }); | |
| 26 | |
| 27 test('parameterized custom tags are not registered', () { | |
| 28 runZoned(() { | |
| 29 expect(_discover(#mirror_loader_test3).length, 0); | |
| 30 }, onError: (e) { | |
| 31 expect(e is UnsupportedError, isTrue); | |
| 32 expect('$e', contains( | |
| 33 'Custom element classes cannot have type-parameters: XB')); | |
| 34 }); | |
| 35 }); | |
| 36 | |
| 37 test('registers correct types even when errors are found', () { | |
| 38 runZoned(() { | |
| 39 expect(_discover(#mirror_loader_test4).length, 1); | |
| 40 }, onError: (e) { | |
| 41 expect(e is UnsupportedError, isTrue); | |
| 42 expect('$e', contains( | |
| 43 'Custom element classes cannot have type-parameters: XB')); | |
| 44 }); | |
| 45 }); | |
| 46 } | |
| 47 | |
| 48 final mirrors = currentMirrorSystem(); | |
| 49 _discover(Symbol name) => | |
| 50 discoverInitializers([mirrors.findLibrary(name).uri.toString()]); | |
| OLD | NEW |