OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** Common definitions used for setting up the test environment. */ | 5 /** Common definitions used for setting up the test environment. */ |
6 library testing; | 6 library testing; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 Future readTextOrBytes(String filename) => readText(filename); | 97 Future readTextOrBytes(String filename) => readText(filename); |
98 | 98 |
99 Future<String> readText(String path) { | 99 Future<String> readText(String path) { |
100 readCount[path] = readCount.putIfAbsent(path, () => 0) + 1; | 100 readCount[path] = readCount.putIfAbsent(path, () => 0) + 1; |
101 var file = _files[path]; | 101 var file = _files[path]; |
102 if (file != null) { | 102 if (file != null) { |
103 return new Future.value(file); | 103 return new Future.value(file); |
104 } else { | 104 } else { |
105 return new Future.error( | 105 return new Future.error( |
106 new FileException('MockFileSystem: $path not found')); | 106 new FileSystemException('MockFileSystem: $path not found')); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 // Compiler doesn't call these | 110 // Compiler doesn't call these |
111 void writeString(String outfile, String text) {} | 111 void writeString(String outfile, String text) {} |
112 Future flush() {} | 112 Future flush() {} |
113 } | 113 } |
OLD | NEW |