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); | |
29 FileSystemState fsState; | 27 FileSystemState fsState; |
30 | 28 |
31 Uri _coreUri; | 29 Uri _coreUri; |
32 List<Uri> _newFileUris = <Uri>[]; | 30 List<Uri> _newFileUris = <Uri>[]; |
33 | 31 |
34 void setUp() { | 32 void setUp() { |
35 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); | 33 var uriTranslator = |
36 uriTranslator.dartLibraries.addAll(dartLibraries); | 34 new UriTranslatorImpl(createSdkFiles(fileSystem), Packages.noPackages); |
37 _coreUri = Uri.parse('dart:core'); | 35 _coreUri = Uri.parse('dart:core'); |
38 expect(_coreUri, isNotNull); | 36 expect(_coreUri, isNotNull); |
39 fsState = new FileSystemState(byteStore, fileSystem, uriTranslator, <int>[], | 37 fsState = new FileSystemState(byteStore, fileSystem, uriTranslator, <int>[], |
40 (uri) { | 38 (uri) { |
41 _newFileUris.add(uri); | 39 _newFileUris.add(uri); |
42 return new Future.value(); | 40 return new Future.value(); |
43 }); | 41 }); |
44 } | 42 } |
45 | 43 |
46 test_apiSignature() async { | 44 test_apiSignature() async { |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 } | 509 } |
512 | 510 |
513 Uri _writeFileDirectives(String path, | 511 Uri _writeFileDirectives(String path, |
514 {List<String> imports: const [], List<String> exports: const []}) { | 512 {List<String> imports: const [], List<String> exports: const []}) { |
515 return writeFile(path, ''' | 513 return writeFile(path, ''' |
516 ${imports.map((uri) => 'import "$uri";').join('\n')} | 514 ${imports.map((uri) => 'import "$uri";').join('\n')} |
517 ${exports.map((uri) => 'export "$uri";').join('\n')} | 515 ${exports.map((uri) => 'export "$uri";').join('\n')} |
518 '''); | 516 '''); |
519 } | 517 } |
520 } | 518 } |
OLD | NEW |