| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// A library for declaratively describing a filesystem structure, usually for | 5 /// A library for declaratively describing a filesystem structure, usually for |
| 6 /// the purpose of creating or validating it as part of a scheduled test. | 6 /// the purpose of creating or validating it as part of a scheduled test. |
| 7 /// | 7 /// |
| 8 /// You can use [dir] and [file] to define a filesystem structure. Then, you can | 8 /// You can use [dir] and [file] to define a filesystem structure. Then, you can |
| 9 /// call [Entry.create] to schedule a task that will create that structure on | 9 /// call [Entry.create] to schedule a task that will create that structure on |
| 10 /// the physical filesystem, or [Entry.validate] to schedule an assertion that | 10 /// the physical filesystem, or [Entry.validate] to schedule an assertion that |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 /// | 60 /// |
| 61 /// // ... | 61 /// // ... |
| 62 /// } | 62 /// } |
| 63 library descriptor; | 63 library descriptor; |
| 64 | 64 |
| 65 import 'dart:async'; | 65 import 'dart:async'; |
| 66 | 66 |
| 67 import 'package:pathos/path.dart' as path; | 67 import 'package:pathos/path.dart' as path; |
| 68 | 68 |
| 69 import 'scheduled_test.dart'; | 69 import 'scheduled_test.dart'; |
| 70 import 'src/descriptor/async.dart'; |
| 70 import 'src/descriptor/directory.dart'; | 71 import 'src/descriptor/directory.dart'; |
| 71 import 'src/descriptor/entry.dart'; | 72 import 'src/descriptor/entry.dart'; |
| 72 import 'src/descriptor/file.dart'; | 73 import 'src/descriptor/file.dart'; |
| 73 | 74 |
| 75 export 'src/descriptor/async.dart'; |
| 74 export 'src/descriptor/directory.dart'; | 76 export 'src/descriptor/directory.dart'; |
| 75 export 'src/descriptor/entry.dart'; | 77 export 'src/descriptor/entry.dart'; |
| 76 export 'src/descriptor/file.dart'; | 78 export 'src/descriptor/file.dart'; |
| 77 | 79 |
| 78 /// The root path for descriptors. Top-level descriptors will be created and | 80 /// The root path for descriptors. Top-level descriptors will be created and |
| 79 /// validated at this path. Defaults to the current working directory. | 81 /// validated at this path. Defaults to the current working directory. |
| 80 /// | 82 /// |
| 81 /// If this is set to `null`, it will reset itself to the current working | 83 /// If this is set to `null`, it will reset itself to the current working |
| 82 /// directory. | 84 /// directory. |
| 83 String get defaultRoot => _defaultRoot == null ? path.current : _defaultRoot; | 85 String get defaultRoot => _defaultRoot == null ? path.current : _defaultRoot; |
| 84 set defaultRoot(String value) { | 86 set defaultRoot(String value) { |
| 85 _defaultRoot = value; | 87 _defaultRoot = value; |
| 86 } | 88 } |
| 87 String _defaultRoot; | 89 String _defaultRoot; |
| 88 | 90 |
| 89 /// Creates a new text [File] descriptor with [name] and [contents]. | 91 /// Creates a new text [File] descriptor with [name] and [contents]. |
| 90 File file(Pattern name, [String contents='']) => new File(name, contents); | 92 File file(Pattern name, [String contents='']) => new File(name, contents); |
| 91 | 93 |
| 92 /// Creates a new binary [File] descriptor with [name] and [contents]. | 94 /// Creates a new binary [File] descriptor with [name] and [contents]. |
| 93 File binaryFile(Pattern name, List<int> contents) => | 95 File binaryFile(Pattern name, List<int> contents) => |
| 94 new File.binary(name, contents); | 96 new File.binary(name, contents); |
| 95 | 97 |
| 96 /// Creates a new [Directory] descriptor with [name] and [contents]. | 98 /// Creates a new [Directory] descriptor with [name] and [contents]. |
| 97 Directory dir(Pattern name, [Iterable<Entry> contents]) => | 99 Directory dir(Pattern name, [Iterable<Entry> contents]) => |
| 98 new Directory(name, contents == null ? <Entry>[] : contents); | 100 new Directory(name, contents == null ? <Entry>[] : contents); |
| 101 |
| 102 /// Creates a new descriptor wrapping a [Future]. This descriptor forwards all |
| 103 /// asynchronous operations to the result of [future]. |
| 104 Async async(Future<Entry> future) => new Async(future); |
| OLD | NEW |