Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1012)

Unified Diff: pkg/analyzer/test/file_system/physical_resource_provider_test.dart

Issue 989393002: Wrap dart:io exception in getChildren(), implement for the memory FS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/file_system/memory_file_system_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/file_system/physical_resource_provider_test.dart
diff --git a/pkg/analyzer/test/file_system/physical_resource_provider_test.dart b/pkg/analyzer/test/file_system/physical_resource_provider_test.dart
index 69eaa11ae1a460b54224061eeb9c6bf63148c8e6..990b61341277b80c33740184f1fb98af613ada93 100644
--- a/pkg/analyzer/test/file_system/physical_resource_provider_test.dart
+++ b/pkg/analyzer/test/file_system/physical_resource_provider_test.dart
@@ -312,27 +312,36 @@ main() {
});
});
- test('getChildren', () {
- // create 2 files and 1 folder
- new io.File(join(path, 'a.txt')).createSync();
- new io.Directory(join(path, 'bFolder')).createSync();
- new io.File(join(path, 'c.txt')).createSync();
- // prepare 3 children
- List<Resource> children = folder.getChildren();
- expect(children, hasLength(3));
- children.sort((a, b) => a.shortName.compareTo(b.shortName));
- // check that each child exists
- children.forEach((child) {
- expect(child.exists, true);
+ group('getChildren', () {
+ test('exists', () {
+ // create 2 files and 1 folder
+ new io.File(join(path, 'a.txt')).createSync();
+ new io.Directory(join(path, 'bFolder')).createSync();
+ new io.File(join(path, 'c.txt')).createSync();
+ // prepare 3 children
+ List<Resource> children = folder.getChildren();
+ expect(children, hasLength(3));
+ children.sort((a, b) => a.shortName.compareTo(b.shortName));
+ // check that each child exists
+ children.forEach((child) {
+ expect(child.exists, true);
+ });
+ // check names
+ expect(children[0].shortName, 'a.txt');
+ expect(children[1].shortName, 'bFolder');
+ expect(children[2].shortName, 'c.txt');
+ // check types
+ expect(children[0], _isFile);
+ expect(children[1], _isFolder);
+ expect(children[2], _isFile);
+ });
+
+ test('does not exist', () {
+ folder = folder.getChildAssumingFolder('no-such-folder');
+ expect(() {
+ folder.getChildren();
+ }, throwsA(_isFileSystemException));
});
- // check names
- expect(children[0].shortName, 'a.txt');
- expect(children[1].shortName, 'bFolder');
- expect(children[2].shortName, 'c.txt');
- // check types
- expect(children[0], _isFile);
- expect(children[1], _isFolder);
- expect(children[2], _isFile);
});
test('parent', () {
« no previous file with comments | « pkg/analyzer/test/file_system/memory_file_system_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698