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 analyzer.test.file_system.physical_resource_provider_test; | 5 library analyzer.test.file_system.physical_resource_provider_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:core'; | 8 import 'dart:core'; |
9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 File file2 = PhysicalResourceProvider.INSTANCE.getResource(path); | 90 File file2 = PhysicalResourceProvider.INSTANCE.getResource(path); |
91 expect(file.hashCode, equals(file2.hashCode)); | 91 expect(file.hashCode, equals(file2.hashCode)); |
92 } | 92 } |
93 | 93 |
94 void test_isOrContains() { | 94 void test_isOrContains() { |
95 File file = PhysicalResourceProvider.INSTANCE.getResource(path); | 95 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
96 expect(file.isOrContains(path), isTrue); | 96 expect(file.isOrContains(path), isTrue); |
97 expect(file.isOrContains('foo'), isFalse); | 97 expect(file.isOrContains('foo'), isFalse); |
98 } | 98 } |
99 | 99 |
| 100 void test_lengthSync_doesNotExist() { |
| 101 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
| 102 expect(() { |
| 103 file.lengthSync; |
| 104 }, throwsA(_isFileSystemException)); |
| 105 } |
| 106 |
| 107 void test_lengthSync_exists() { |
| 108 List<int> bytes = <int>[1, 2, 3, 4, 5]; |
| 109 new io.File(path).writeAsBytesSync(bytes); |
| 110 expect(file.lengthSync, bytes.length); |
| 111 } |
| 112 |
100 void test_modificationStamp_doesNotExist() { | 113 void test_modificationStamp_doesNotExist() { |
101 File file = PhysicalResourceProvider.INSTANCE.getResource(path); | 114 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
102 expect(() { | 115 expect(() { |
103 file.modificationStamp; | 116 file.modificationStamp; |
104 }, throwsA(_isFileSystemException)); | 117 }, throwsA(_isFileSystemException)); |
105 } | 118 } |
106 | 119 |
107 void test_modificationStamp_exists() { | 120 void test_modificationStamp_exists() { |
108 new io.File(path).writeAsStringSync('contents'); | 121 new io.File(path).writeAsStringSync('contents'); |
109 File file = PhysicalResourceProvider.INSTANCE.getResource(path); | 122 File file = PhysicalResourceProvider.INSTANCE.getResource(path); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 636 |
624 setUp() { | 637 setUp() { |
625 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); | 638 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); |
626 tempPath = tempDirectory.absolute.path; | 639 tempPath = tempDirectory.absolute.path; |
627 } | 640 } |
628 | 641 |
629 tearDown() { | 642 tearDown() { |
630 tempDirectory.deleteSync(recursive: true); | 643 tempDirectory.deleteSync(recursive: true); |
631 } | 644 } |
632 } | 645 } |
OLD | NEW |