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.memory_file_system_test; | 5 library analyzer.test.file_system.memory_file_system_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
9 | 9 |
10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 expect(child.exists, isTrue); | 265 expect(child.exists, isTrue); |
266 } | 266 } |
267 | 267 |
268 void test_getChild_folder() { | 268 void test_getChild_folder() { |
269 provider.newFolder('/foo/bar/baz'); | 269 provider.newFolder('/foo/bar/baz'); |
270 Folder child = folder.getChild('baz'); | 270 Folder child = folder.getChild('baz'); |
271 expect(child, isNotNull); | 271 expect(child, isNotNull); |
272 expect(child.exists, isTrue); | 272 expect(child.exists, isTrue); |
273 } | 273 } |
274 | 274 |
| 275 void test_getChildAssumingFile_doesNotExist() { |
| 276 File child = folder.getChildAssumingFile('name'); |
| 277 expect(child, isNotNull); |
| 278 expect(child.exists, isFalse); |
| 279 } |
| 280 |
| 281 void test_getChildAssumingFile_file() { |
| 282 provider.newFile('/foo/bar/name', 'content'); |
| 283 File child = folder.getChildAssumingFile('name'); |
| 284 expect(child, isNotNull); |
| 285 expect(child.exists, isTrue); |
| 286 } |
| 287 |
| 288 void test_getChildAssumingFile_folder() { |
| 289 provider.newFolder('/foo/bar/name'); |
| 290 File child = folder.getChildAssumingFile('name'); |
| 291 expect(child, isNotNull); |
| 292 expect(child.exists, isFalse); |
| 293 } |
| 294 |
275 void test_getChildAssumingFolder_doesNotExist() { | 295 void test_getChildAssumingFolder_doesNotExist() { |
276 Folder child = folder.getChildAssumingFolder('foldername'); | 296 Folder child = folder.getChildAssumingFolder('foldername'); |
277 expect(child, isNotNull); | 297 expect(child, isNotNull); |
278 expect(child.exists, isFalse); | 298 expect(child.exists, isFalse); |
279 } | 299 } |
280 | 300 |
281 void test_getChildAssumingFolder_file() { | 301 void test_getChildAssumingFolder_file() { |
282 provider.newFile('/foo/bar/foldername', 'content'); | 302 provider.newFile('/foo/bar/foldername', 'content'); |
283 Folder child = folder.getChildAssumingFolder('foldername'); | 303 Folder child = folder.getChildAssumingFolder('foldername'); |
284 expect(child, isNotNull); | 304 expect(child, isNotNull); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 return new Future.delayed(Duration.ZERO, computation); | 659 return new Future.delayed(Duration.ZERO, computation); |
640 } | 660 } |
641 | 661 |
642 _watchingFolder(String path, test(List<WatchEvent> changesReceived)) { | 662 _watchingFolder(String path, test(List<WatchEvent> changesReceived)) { |
643 Folder folder = provider.getResource(path); | 663 Folder folder = provider.getResource(path); |
644 var changesReceived = <WatchEvent>[]; | 664 var changesReceived = <WatchEvent>[]; |
645 folder.changes.listen(changesReceived.add); | 665 folder.changes.listen(changesReceived.add); |
646 return test(changesReceived); | 666 return test(changesReceived); |
647 } | 667 } |
648 } | 668 } |
OLD | NEW |