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

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

Issue 2993113003: Revert "Switch FE to use the libraries.json format." (Closed)
Patch Set: Created 3 years, 4 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/base/libraries_specification.dart';
6 import 'package:front_end/src/fasta/uri_translator_impl.dart'; 5 import 'package:front_end/src/fasta/uri_translator_impl.dart';
7 import 'package:package_config/packages.dart'; 6 import 'package:package_config/packages.dart';
8 import 'package:test/test.dart'; 7 import 'package:test/test.dart';
9 import 'package:test_reflective_loader/test_reflective_loader.dart'; 8 import 'package:test_reflective_loader/test_reflective_loader.dart';
10 9
11 main() { 10 main() {
12 defineReflectiveSuite(() { 11 defineReflectiveSuite(() {
13 defineReflectiveTests(UriTranslatorImplTest); 12 defineReflectiveTests(UriTranslatorImplTest);
14 }); 13 });
15 } 14 }
16 15
17 @reflectiveTest 16 @reflectiveTest
18 class UriTranslatorImplTest { 17 class UriTranslatorImplTest {
19 UriTranslatorImpl translator = new UriTranslatorImpl( 18 void test_isPlatformImplementation() {
20 new TargetLibrariesSpecification('vm', { 19 var translator = new UriTranslatorImpl({
21 'core': new LibraryInfo( 20 'core': Uri.parse('file:///sdk/core/core.dart'),
22 'core', Uri.parse('file:///sdk/core/core.dart'), const []), 21 'math': Uri.parse('file:///sdk/math/math.dart')
23 'math': new LibraryInfo( 22 }, {}, Packages.noPackages);
24 'core', Uri.parse('file:///sdk/math/math.dart'), const []),
25 }),
26 Packages.noPackages);
27 23
28 void test_isPlatformImplementation() {
29 bool isPlatform(String uriStr) { 24 bool isPlatform(String uriStr) {
30 var uri = Uri.parse(uriStr); 25 var uri = Uri.parse(uriStr);
31 return translator.isPlatformImplementation(uri); 26 return translator.isPlatformImplementation(uri);
32 } 27 }
33 28
34 expect(isPlatform('dart:core/string.dart'), isTrue); 29 expect(isPlatform('dart:core/string.dart'), isTrue);
35 expect(isPlatform('dart:core'), isFalse); 30 expect(isPlatform('dart:core'), isFalse);
36 expect(isPlatform('dart:_builtin'), isTrue); 31 expect(isPlatform('dart:_builtin'), isTrue);
37 expect(isPlatform('file:///sdk/math/math.dart'), isFalse); 32 expect(isPlatform('file:///sdk/math/math.dart'), isFalse);
38 } 33 }
39 34
40 void test_translate_dart() { 35 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 }
OLDNEW
« no previous file with comments | « pkg/front_end/test/fasta/testing/suite.dart ('k') | pkg/front_end/test/incremental_kernel_generator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698