| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 tests.dart2js.lookup_map_test; | 5 library tests.dart2js.lookup_map_test; |
| 6 | 6 |
| 7 import 'package:test/test.dart'; | 7 import 'package:test/test.dart'; |
| 8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 Map<String, String> testDeclarations = { | 11 Map<String, String> testDeclarations = { |
| 12 'types': r''' | 12 'types': r''' |
| 13 import 'package:lookup_map/lookup_map.dart'; | 13 import 'package:lookup_map/lookup_map.dart'; |
| 14 class A {} | 14 class A {} |
| 15 class B {} | 15 class B {} |
| 16 class C {} | 16 class C {} |
| 17 class D {} | 17 class D {} |
| 18 class E {}''', | 18 class E {}''', |
| 19 | |
| 20 'const keys': r''' | 19 'const keys': r''' |
| 21 import 'package:lookup_map/lookup_map.dart'; | 20 import 'package:lookup_map/lookup_map.dart'; |
| 22 class Key { final name; const Key(this.name); } | 21 class Key { final name; const Key(this.name); } |
| 23 const A = const Key("A"); | 22 const A = const Key("A"); |
| 24 const B = const Key("B"); | 23 const B = const Key("B"); |
| 25 const C = const Key("C"); | 24 const C = const Key("C"); |
| 26 const D = const Key("D"); | 25 const D = const Key("D"); |
| 27 const E = const Key("E");''', | 26 const E = const Key("E");''', |
| 28 | |
| 29 'mixed keys': r''' | 27 'mixed keys': r''' |
| 30 import 'package:lookup_map/lookup_map.dart'; | 28 import 'package:lookup_map/lookup_map.dart'; |
| 31 class Key { final name; const Key(this.name); } | 29 class Key { final name; const Key(this.name); } |
| 32 const A = const Key("A"); | 30 const A = const Key("A"); |
| 33 class B {} | 31 class B {} |
| 34 const C = const Key("C"); | 32 const C = const Key("C"); |
| 35 class D {} | 33 class D {} |
| 36 const E = const Key("E");''', | 34 const E = const Key("E");''', |
| 37 }; | 35 }; |
| 38 | 36 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 main() { | 383 main() { |
| 386 reflectType(A); | 384 reflectType(A); |
| 387 print(map[A]); | 385 print(map[A]); |
| 388 } | 386 } |
| 389 """); | 387 """); |
| 390 expect(generated, contains("the-text-for-A")); | 388 expect(generated, contains("the-text-for-A")); |
| 391 expect(generated, contains("the-text-for-B")); | 389 expect(generated, contains("the-text-for-B")); |
| 392 expect(generated, isNot(contains("the-text-for-C"))); | 390 expect(generated, isNot(contains("the-text-for-C"))); |
| 393 }); | 391 }); |
| 394 } | 392 } |
| OLD | NEW |