Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: pkg/front_end/test/fasta/uri_translator_test.dart

Issue 2979003002: support resolving .packages in FE (Closed)
Patch Set: cl comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/uri_translator_impl.dart'; 5 import 'package:front_end/src/fasta/uri_translator_impl.dart';
6 import 'package:package_config/packages.dart';
6 import 'package:test/test.dart'; 7 import 'package:test/test.dart';
7 import 'package:test_reflective_loader/test_reflective_loader.dart'; 8 import 'package:test_reflective_loader/test_reflective_loader.dart';
8 9
9 main() { 10 main() {
10 defineReflectiveSuite(() { 11 defineReflectiveSuite(() {
11 defineReflectiveTests(UriTranslatorImplTest); 12 defineReflectiveTests(UriTranslatorImplTest);
12 }); 13 });
13 } 14 }
14 15
15 @reflectiveTest 16 @reflectiveTest
16 class UriTranslatorImplTest { 17 class UriTranslatorImplTest {
17 void test_isPlatformImplementation() { 18 void test_isPlatformImplementation() {
18 var translator = new UriTranslatorImpl({ 19 var translator = new UriTranslatorImpl({
19 'core': Uri.parse('file:///sdk/core/core.dart'), 20 'core': Uri.parse('file:///sdk/core/core.dart'),
20 'math': Uri.parse('file:///sdk/math/math.dart') 21 'math': Uri.parse('file:///sdk/math/math.dart')
21 }, {}, {}); 22 }, {}, Packages.noPackages);
22 23
23 bool isPlatform(String uriStr) { 24 bool isPlatform(String uriStr) {
24 var uri = Uri.parse(uriStr); 25 var uri = Uri.parse(uriStr);
25 return translator.isPlatformImplementation(uri); 26 return translator.isPlatformImplementation(uri);
26 } 27 }
27 28
28 expect(isPlatform('dart:core/string.dart'), isTrue); 29 expect(isPlatform('dart:core/string.dart'), isTrue);
29 expect(isPlatform('dart:core'), isFalse); 30 expect(isPlatform('dart:core'), isFalse);
30 expect(isPlatform('dart:_builtin'), isTrue); 31 expect(isPlatform('dart:_builtin'), isTrue);
31 expect(isPlatform('file:///sdk/math/math.dart'), isFalse); 32 expect(isPlatform('file:///sdk/math/math.dart'), isFalse);
32 } 33 }
33 34
34 void test_translate_dart() { 35 void test_translate_dart() {
35 var translator = new UriTranslatorImpl({ 36 var translator = new UriTranslatorImpl({
36 'core': Uri.parse('file:///sdk/core/core.dart'), 37 'core': Uri.parse('file:///sdk/core/core.dart'),
37 'math': Uri.parse('file:///sdk/math/math.dart') 38 'math': Uri.parse('file:///sdk/math/math.dart')
38 }, {}, {}); 39 }, {}, Packages.noPackages);
39 40
40 expect(translator.translate(Uri.parse('dart:core')), 41 expect(translator.translate(Uri.parse('dart:core')),
41 Uri.parse('file:///sdk/core/core.dart')); 42 Uri.parse('file:///sdk/core/core.dart'));
42 expect(translator.translate(Uri.parse('dart:core/string.dart')), 43 expect(translator.translate(Uri.parse('dart:core/string.dart')),
43 Uri.parse('file:///sdk/core/string.dart')); 44 Uri.parse('file:///sdk/core/string.dart'));
44 45
45 expect(translator.translate(Uri.parse('dart:math')), 46 expect(translator.translate(Uri.parse('dart:math')),
46 Uri.parse('file:///sdk/math/math.dart')); 47 Uri.parse('file:///sdk/math/math.dart'));
47 } 48 }
48 } 49 }
OLDNEW
« no previous file with comments | « pkg/front_end/test/dependency_grapher_test.dart ('k') | pkg/front_end/test/src/base/processed_options_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698