| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library test.physical_file_system; | 5 library test.physical_file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 File file = PhysicalResourceProvider.INSTANCE.getResource(path); | 95 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
| 96 expect(file.modificationStamp, isNonNegative); | 96 expect(file.modificationStamp, isNonNegative); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void test_parent() { | 99 void test_parent() { |
| 100 Resource parent = file.parent; | 100 Resource parent = file.parent; |
| 101 expect(parent, new isInstanceOf<Folder>()); | 101 expect(parent, new isInstanceOf<Folder>()); |
| 102 expect(parent.path, equals(tempPath)); | 102 expect(parent.path, equals(tempPath)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void test_readAsStringSync_doesNotExist() { |
| 106 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
| 107 expect(() { |
| 108 file.readAsStringSync(); |
| 109 }, throwsA(_isFileSystemException)); |
| 110 } |
| 111 |
| 112 void test_readAsStringSync_exists() { |
| 113 new io.File(path).writeAsStringSync('abc'); |
| 114 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
| 115 expect(file.readAsStringSync(), 'abc'); |
| 116 } |
| 117 |
| 105 void test_shortName() { | 118 void test_shortName() { |
| 106 expect(file.shortName, 'file.txt'); | 119 expect(file.shortName, 'file.txt'); |
| 107 } | 120 } |
| 108 | 121 |
| 109 void test_toString() { | 122 void test_toString() { |
| 110 expect(file.toString(), path); | 123 expect(file.toString(), path); |
| 111 } | 124 } |
| 112 } | 125 } |
| 113 | 126 |
| 114 @reflectiveTest | 127 @reflectiveTest |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 386 |
| 374 setUp() { | 387 setUp() { |
| 375 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); | 388 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); |
| 376 tempPath = tempDirectory.absolute.path; | 389 tempPath = tempDirectory.absolute.path; |
| 377 } | 390 } |
| 378 | 391 |
| 379 tearDown() { | 392 tearDown() { |
| 380 tempDirectory.deleteSync(recursive: true); | 393 tempDirectory.deleteSync(recursive: true); |
| 381 } | 394 } |
| 382 } | 395 } |
| OLD | NEW |