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 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:front_end/memory_file_system.dart'; | 7 import 'package:front_end/memory_file_system.dart'; |
8 import 'package:front_end/src/fasta/uri_translator_impl.dart'; | 8 import 'package:front_end/src/fasta/uri_translator_impl.dart'; |
9 import 'package:front_end/src/incremental/byte_store.dart'; | 9 import 'package:front_end/src/incremental/byte_store.dart'; |
10 import 'package:front_end/src/incremental/file_state.dart'; | 10 import 'package:front_end/src/incremental/file_state.dart'; |
11 import 'package:package_config/packages.dart'; | 11 import 'package:package_config/packages.dart'; |
12 import 'package:test/test.dart'; | 12 import 'package:test/test.dart'; |
13 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
14 | 14 |
15 import 'mock_sdk.dart'; | 15 import 'mock_sdk.dart'; |
16 | 16 |
17 main() { | 17 main() { |
18 defineReflectiveSuite(() { | 18 defineReflectiveSuite(() { |
19 defineReflectiveTests(FileSystemStateTest); | 19 defineReflectiveTests(FileSystemStateTest); |
20 }); | 20 }); |
21 } | 21 } |
22 | 22 |
23 @reflectiveTest | 23 @reflectiveTest |
24 class FileSystemStateTest { | 24 class FileSystemStateTest { |
25 final byteStore = new MemoryByteStore(); | 25 final byteStore = new MemoryByteStore(); |
26 final fileSystem = new MemoryFileSystem(Uri.parse('file:///')); | 26 final fileSystem = new MemoryFileSystem(Uri.parse('file:///')); |
| 27 final UriTranslatorImpl uriTranslator = |
| 28 new UriTranslatorImpl({}, {}, Packages.noPackages); |
27 FileSystemState fsState; | 29 FileSystemState fsState; |
28 | 30 |
29 Uri _coreUri; | 31 Uri _coreUri; |
30 List<Uri> _newFileUris = <Uri>[]; | 32 List<Uri> _newFileUris = <Uri>[]; |
31 | 33 |
32 void setUp() { | 34 void setUp() { |
33 var uriTranslator = | 35 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); |
34 new UriTranslatorImpl(createSdkFiles(fileSystem), Packages.noPackages); | 36 uriTranslator.dartLibraries.addAll(dartLibraries); |
35 _coreUri = Uri.parse('dart:core'); | 37 _coreUri = Uri.parse('dart:core'); |
36 expect(_coreUri, isNotNull); | 38 expect(_coreUri, isNotNull); |
37 fsState = new FileSystemState(byteStore, fileSystem, uriTranslator, <int>[], | 39 fsState = new FileSystemState(byteStore, fileSystem, uriTranslator, <int>[], |
38 (uri) { | 40 (uri) { |
39 _newFileUris.add(uri); | 41 _newFileUris.add(uri); |
40 return new Future.value(); | 42 return new Future.value(); |
41 }); | 43 }); |
42 } | 44 } |
43 | 45 |
44 test_apiSignature() async { | 46 test_apiSignature() async { |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 } | 511 } |
510 | 512 |
511 Uri _writeFileDirectives(String path, | 513 Uri _writeFileDirectives(String path, |
512 {List<String> imports: const [], List<String> exports: const []}) { | 514 {List<String> imports: const [], List<String> exports: const []}) { |
513 return writeFile(path, ''' | 515 return writeFile(path, ''' |
514 ${imports.map((uri) => 'import "$uri";').join('\n')} | 516 ${imports.map((uri) => 'import "$uri";').join('\n')} |
515 ${exports.map((uri) => 'export "$uri";').join('\n')} | 517 ${exports.map((uri) => 'export "$uri";').join('\n')} |
516 '''); | 518 '''); |
517 } | 519 } |
518 } | 520 } |
OLD | NEW |