| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 'package:front_end/src/fasta/translate_uri.dart'; | 5 import 'package:front_end/src/fasta/translate_uri.dart'; |
| 6 import 'package:test/test.dart'; | 6 import 'package:test/test.dart'; |
| 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 8 | 8 |
| 9 main() { | 9 main() { |
| 10 defineReflectiveSuite(() { | 10 defineReflectiveSuite(() { |
| 11 defineReflectiveTests(TranslateUriTest); | 11 defineReflectiveTests(TranslateUriTest); |
| 12 }); | 12 }); |
| 13 } | 13 } |
| 14 | 14 |
| 15 @reflectiveTest | 15 @reflectiveTest |
| 16 class TranslateUriTest { | 16 class TranslateUriTest { |
| 17 void test_translate_dart() { | 17 void test_translate_dart() { |
| 18 var translator = new TranslateUri({}, { | 18 var translator = new TranslateUri({}, { |
| 19 'core': Uri.parse('file:///sdk/core/core.dart'), | 19 'core': Uri.parse('file:///sdk/core/core.dart'), |
| 20 'math': Uri.parse('file:///sdk/math/math.dart') | 20 'math': Uri.parse('file:///sdk/math/math.dart') |
| 21 }); | 21 }, {}); |
| 22 | 22 |
| 23 expect(translator.translate(Uri.parse('dart:core')), | 23 expect(translator.translate(Uri.parse('dart:core')), |
| 24 Uri.parse('file:///sdk/core/core.dart')); | 24 Uri.parse('file:///sdk/core/core.dart')); |
| 25 expect(translator.translate(Uri.parse('dart:core/string.dart')), | 25 expect(translator.translate(Uri.parse('dart:core/string.dart')), |
| 26 Uri.parse('file:///sdk/core/string.dart')); | 26 Uri.parse('file:///sdk/core/string.dart')); |
| 27 | 27 |
| 28 expect(translator.translate(Uri.parse('dart:math')), | 28 expect(translator.translate(Uri.parse('dart:math')), |
| 29 Uri.parse('file:///sdk/math/math.dart')); | 29 Uri.parse('file:///sdk/math/math.dart')); |
| 30 | 30 |
| 31 expect(translator.translate(Uri.parse('dart:unknown')), isNull); | 31 expect(translator.translate(Uri.parse('dart:unknown')), isNull); |
| 32 |
| 33 expect( |
| 34 translator.isPlatformImplementation(Uri.parse('dart:core/string.dart')), |
| 35 isTrue); |
| 36 expect( |
| 37 translator.isPlatformImplementation(Uri.parse('dart:core')), isFalse); |
| 38 expect(translator.isPlatformImplementation(Uri.parse('dart:_builtin')), |
| 39 isTrue); |
| 40 expect( |
| 41 translator |
| 42 .isPlatformImplementation(Uri.parse('file:///sdk/math/math.dart')), |
| 43 isFalse); |
| 32 } | 44 } |
| 33 } | 45 } |
| OLD | NEW |