| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // SharedOptions=--supermixin | 4 // SharedOptions=--supermixin |
| 5 | 5 |
| 6 library front_end.test.memory_file_system_test; | 6 library front_end.test.memory_file_system_test; |
| 7 | 7 |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 test_exists_exists() async { | 52 test_exists_exists() async { |
| 53 file.writeAsStringSync('x'); | 53 file.writeAsStringSync('x'); |
| 54 expect(await file.exists(), true); | 54 expect(await file.exists(), true); |
| 55 } | 55 } |
| 56 | 56 |
| 57 test_hashCode_samePath() { | 57 test_hashCode_samePath() { |
| 58 expect(file.hashCode, entityForPath(join(tempPath, 'file.txt')).hashCode); | 58 expect(file.hashCode, entityForPath(join(tempPath, 'file.txt')).hashCode); |
| 59 } | 59 } |
| 60 | 60 |
| 61 test_lastModified_doesNotExist() async { | |
| 62 expect(file.lastModified(), _throwsFileSystemException); | |
| 63 } | |
| 64 | |
| 65 test_lastModified_increasesOnEachChange() async { | |
| 66 file.writeAsStringSync('x'); | |
| 67 var mod1 = await file.lastModified(); | |
| 68 file.writeAsStringSync('y'); | |
| 69 var mod2 = await file.lastModified(); | |
| 70 expect(mod2.isAfter(mod1), isTrue); | |
| 71 | |
| 72 var file2 = entityForPath(join(tempPath, 'file2.txt')); | |
| 73 file2.writeAsStringSync('z'); | |
| 74 var mod3 = await file2.lastModified(); | |
| 75 expect(mod3.isAfter(mod2), isTrue); | |
| 76 } | |
| 77 | |
| 78 test_path() { | 61 test_path() { |
| 79 expect(file.uri, context.toUri(path)); | 62 expect(file.uri, context.toUri(path)); |
| 80 } | 63 } |
| 81 | 64 |
| 82 test_readAsBytes_badUtf8() async { | 65 test_readAsBytes_badUtf8() async { |
| 83 // A file containing invalid UTF-8 can still be read as raw bytes. | 66 // A file containing invalid UTF-8 can still be read as raw bytes. |
| 84 List<int> bytes = [0xc0, 0x40]; // Invalid UTF-8 | 67 List<int> bytes = [0xc0, 0x40]; // Invalid UTF-8 |
| 85 file.writeAsBytesSync(bytes); | 68 file.writeAsBytesSync(bytes); |
| 86 expect(await file.readAsBytes(), bytes); | 69 expect(await file.readAsBytes(), bytes); |
| 87 } | 70 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 String tempPath; | 269 String tempPath; |
| 287 | 270 |
| 288 String join(String path1, String path2, [String path3, String path4]) => | 271 String join(String path1, String path2, [String path3, String path4]) => |
| 289 pathos.windows.join(path1, path2, path3, path4); | 272 pathos.windows.join(path1, path2, path3, path4); |
| 290 | 273 |
| 291 void setUp() { | 274 void setUp() { |
| 292 tempPath = r'c:\test_file_system'; | 275 tempPath = r'c:\test_file_system'; |
| 293 fileSystem = new MemoryFileSystem(Uri.parse('file:///c:/cwd')); | 276 fileSystem = new MemoryFileSystem(Uri.parse('file:///c:/cwd')); |
| 294 } | 277 } |
| 295 } | 278 } |
| OLD | NEW |