Chromium Code Reviews| 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/base/libraries_spec.dart'; | |
| 5 import 'package:front_end/src/fasta/uri_translator_impl.dart'; | 6 import 'package:front_end/src/fasta/uri_translator_impl.dart'; |
| 6 import 'package:package_config/packages.dart'; | 7 import 'package:package_config/packages.dart'; |
| 7 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 9 | 10 |
| 10 main() { | 11 main() { |
| 11 defineReflectiveSuite(() { | 12 defineReflectiveSuite(() { |
| 12 defineReflectiveTests(UriTranslatorImplTest); | 13 defineReflectiveTests(UriTranslatorImplTest); |
| 13 }); | 14 }); |
| 14 } | 15 } |
| 15 | 16 |
| 16 @reflectiveTest | 17 @reflectiveTest |
| 17 class UriTranslatorImplTest { | 18 class UriTranslatorImplTest { |
| 19 UriTranslatorImpl translator = new UriTranslatorImpl( | |
| 20 new TargetLibrariesSpecification('vm', { | |
| 21 'core': new LibraryInfo( | |
| 22 'core', Uri.parse('file:///sdk/core/core.dart'), const []), | |
|
ahe
2017/08/03 11:58:16
These aren't names of real files. Please don't use
Siggi Cherem (dart-lang)
2017/08/05 00:41:02
Ack. See other comment, I left this as it was in t
| |
| 23 'math': new LibraryInfo( | |
| 24 'core', Uri.parse('file:///sdk/math/math.dart'), const []), | |
| 25 }), | |
| 26 Packages.noPackages); | |
| 27 | |
| 18 void test_isPlatformImplementation() { | 28 void test_isPlatformImplementation() { |
| 19 var translator = new UriTranslatorImpl({ | |
| 20 'core': Uri.parse('file:///sdk/core/core.dart'), | |
| 21 'math': Uri.parse('file:///sdk/math/math.dart') | |
| 22 }, {}, Packages.noPackages); | |
| 23 | |
| 24 bool isPlatform(String uriStr) { | 29 bool isPlatform(String uriStr) { |
| 25 var uri = Uri.parse(uriStr); | 30 var uri = Uri.parse(uriStr); |
| 26 return translator.isPlatformImplementation(uri); | 31 return translator.isPlatformImplementation(uri); |
| 27 } | 32 } |
| 28 | 33 |
| 29 expect(isPlatform('dart:core/string.dart'), isTrue); | 34 expect(isPlatform('dart:core/string.dart'), isTrue); |
| 30 expect(isPlatform('dart:core'), isFalse); | 35 expect(isPlatform('dart:core'), isFalse); |
| 31 expect(isPlatform('dart:_builtin'), isTrue); | 36 expect(isPlatform('dart:_builtin'), isTrue); |
| 32 expect(isPlatform('file:///sdk/math/math.dart'), isFalse); | 37 expect(isPlatform('file:///sdk/math/math.dart'), isFalse); |
| 33 } | 38 } |
| 34 | 39 |
| 35 void test_translate_dart() { | 40 void test_translate_dart() { |
| 36 var translator = new UriTranslatorImpl({ | |
| 37 'core': Uri.parse('file:///sdk/core/core.dart'), | |
| 38 'math': Uri.parse('file:///sdk/math/math.dart') | |
| 39 }, {}, Packages.noPackages); | |
| 40 | |
| 41 expect(translator.translate(Uri.parse('dart:core')), | 41 expect(translator.translate(Uri.parse('dart:core')), |
| 42 Uri.parse('file:///sdk/core/core.dart')); | 42 Uri.parse('file:///sdk/core/core.dart')); |
| 43 expect(translator.translate(Uri.parse('dart:core/string.dart')), | 43 expect(translator.translate(Uri.parse('dart:core/string.dart')), |
| 44 Uri.parse('file:///sdk/core/string.dart')); | 44 Uri.parse('file:///sdk/core/string.dart')); |
| 45 | 45 |
| 46 expect(translator.translate(Uri.parse('dart:math')), | 46 expect(translator.translate(Uri.parse('dart:math')), |
| 47 Uri.parse('file:///sdk/math/math.dart')); | 47 Uri.parse('file:///sdk/math/math.dart')); |
| 48 } | 48 } |
| 49 } | 49 } |
| OLD | NEW |