| 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 [Descriptor.create] to schedule a task that will create that structure | 9 /// call [Descriptor.create] to schedule a task that will create that structure |
| 10 /// on the physical filesystem, or [Descriptor.validate] to schedule an | 10 /// on the physical filesystem, or [Descriptor.validate] to schedule an |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 /// filesystem descriptors are rooted on the physical filesystem. For example, | 39 /// filesystem descriptors are rooted on the physical filesystem. For example, |
| 40 /// to create a temporary directory for each test: | 40 /// to create a temporary directory for each test: |
| 41 /// | 41 /// |
| 42 /// import 'package:scheduled_test/descriptor.dart' as d; | 42 /// import 'package:scheduled_test/descriptor.dart' as d; |
| 43 /// import 'package:scheduled_test/scheduled_test.dart'; | 43 /// import 'package:scheduled_test/scheduled_test.dart'; |
| 44 /// | 44 /// |
| 45 /// void main() { | 45 /// void main() { |
| 46 /// setUp(() { | 46 /// setUp(() { |
| 47 /// var tempDir; | 47 /// var tempDir; |
| 48 /// schedule(() { | 48 /// schedule(() { |
| 49 /// return new Directory('').createTemp().then((dir) { | 49 /// return Directory.systemTemp |
| 50 /// .createTemp('my_temp_dir_') |
| 51 /// .then((dir) { |
| 50 /// tempDir = dir; | 52 /// tempDir = dir; |
| 51 /// d.defaultRoot = tempDir.path; | 53 /// d.defaultRoot = tempDir.path; |
| 52 /// }); | 54 /// }); |
| 53 /// }); | 55 /// }); |
| 54 /// | 56 /// |
| 55 /// currentSchedule.onComplete.schedule(() { | 57 /// currentSchedule.onComplete.schedule(() { |
| 56 /// d.defaultRoot = null; | 58 /// d.defaultRoot = null; |
| 57 /// return tempDir.delete(recursive: true); | 59 /// return tempDir.delete(recursive: true); |
| 58 /// }); | 60 /// }); |
| 59 /// }); | 61 /// }); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 135 |
| 134 /// A convenience method for creating a [PatternDescriptor] descriptor that | 136 /// A convenience method for creating a [PatternDescriptor] descriptor that |
| 135 /// constructs a [FileDescriptor] descriptor. | 137 /// constructs a [FileDescriptor] descriptor. |
| 136 PatternDescriptor filePattern(Pattern name, [String contents='']) => | 138 PatternDescriptor filePattern(Pattern name, [String contents='']) => |
| 137 pattern(name, (realName) => file(realName, contents)); | 139 pattern(name, (realName) => file(realName, contents)); |
| 138 | 140 |
| 139 /// A convenience method for creating a [PatternDescriptor] descriptor that | 141 /// A convenience method for creating a [PatternDescriptor] descriptor that |
| 140 /// constructs a [DirectoryDescriptor] descriptor. | 142 /// constructs a [DirectoryDescriptor] descriptor. |
| 141 PatternDescriptor dirPattern(Pattern name, [Iterable<Descriptor> contents]) => | 143 PatternDescriptor dirPattern(Pattern name, [Iterable<Descriptor> contents]) => |
| 142 pattern(name, (realName) => dir(realName, contents)); | 144 pattern(name, (realName) => dir(realName, contents)); |
| OLD | NEW |