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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 _defaultRoot = value; | 93 _defaultRoot = value; |
94 } | 94 } |
95 String _defaultRoot; | 95 String _defaultRoot; |
96 | 96 |
97 /// Creates a new text [FileDescriptor] with [name] and [contents]. | 97 /// Creates a new text [FileDescriptor] with [name] and [contents]. |
98 FileDescriptor file(String name, [String contents='']) => | 98 FileDescriptor file(String name, [String contents='']) => |
99 new FileDescriptor(name, contents); | 99 new FileDescriptor(name, contents); |
100 | 100 |
101 /// Creates a new binary [FileDescriptor] descriptor with [name] and [contents]. | 101 /// Creates a new binary [FileDescriptor] descriptor with [name] and [contents]. |
102 FileDescriptor binaryFile(String name, List<int> contents) => | 102 FileDescriptor binaryFile(String name, List<int> contents) => |
103 new FileDescriptor.binary(name, contents); | 103 new FileDescriptor.binary(name, contents); |
nweiz
2014/02/13 22:01:53
I don't like this change. I think "=>" methods sho
kevmoo
2014/02/17 20:00:19
If a line is considered a continuation, its indent
nweiz
2014/02/19 21:13:46
I don't think these lines should be considered con
Bob Nystrom
2014/02/19 21:18:54
Except that unlike method bodies, they implicitly
nweiz
2014/02/19 21:33:56
I don't agree, but it seems I'm in the minority on
| |
104 | 104 |
105 /// Creates a new text [FileDescriptor] with [name] that matches its String | 105 /// Creates a new text [FileDescriptor] with [name] that matches its String |
106 /// contents against [matcher]. If the file is created, it's considered to be | 106 /// contents against [matcher]. If the file is created, it's considered to be |
107 /// empty. | 107 /// empty. |
108 FileDescriptor matcherFile(String name, matcher) => | 108 FileDescriptor matcherFile(String name, matcher) => |
109 new FileDescriptor.matcher(name, wrapMatcher(matcher)); | 109 new FileDescriptor.matcher(name, wrapMatcher(matcher)); |
110 | 110 |
111 /// Creates a new binary [FileDescriptor] with [name] that matches its binary | 111 /// Creates a new binary [FileDescriptor] with [name] that matches its binary |
112 /// contents against [matcher]. If the file is created, it's considered to be | 112 /// contents against [matcher]. If the file is created, it's considered to be |
113 /// empty. | 113 /// empty. |
114 FileDescriptor binaryMatcherFile(String name, matcher) => | 114 FileDescriptor binaryMatcherFile(String name, matcher) => |
115 new FileDescriptor.binaryMatcher(name, wrapMatcher(matcher)); | 115 new FileDescriptor.binaryMatcher(name, wrapMatcher(matcher)); |
116 | 116 |
117 /// Creates a new [DirectoryDescriptor] descriptor with [name] and [contents]. | 117 /// Creates a new [DirectoryDescriptor] descriptor with [name] and [contents]. |
118 DirectoryDescriptor dir(String name, [Iterable<Descriptor> contents]) => | 118 DirectoryDescriptor dir(String name, [Iterable<Descriptor> contents]) => |
119 new DirectoryDescriptor(name, contents == null? <Descriptor>[] : contents); | 119 new DirectoryDescriptor(name, contents == null ? <Descriptor>[] : contents); |
120 | 120 |
121 /// Creates a new descriptor wrapping a [Future]. This descriptor forwards all | 121 /// Creates a new descriptor wrapping a [Future]. This descriptor forwards all |
122 /// asynchronous operations to the result of [future]. | 122 /// asynchronous operations to the result of [future]. |
123 AsyncDescriptor async(Future<Descriptor> future) => | 123 AsyncDescriptor async(Future<Descriptor> future) => new AsyncDescriptor(future); |
124 new AsyncDescriptor(future); | |
125 | 124 |
126 /// Creates a new [NothingDescriptor] descriptor that asserts that no entry | 125 /// Creates a new [NothingDescriptor] descriptor that asserts that no entry |
127 /// named [name] exists. | 126 /// named [name] exists. |
128 NothingDescriptor nothing(String name) => new NothingDescriptor(name); | 127 NothingDescriptor nothing(String name) => new NothingDescriptor(name); |
129 | 128 |
130 /// Creates a new [PatternDescriptor] descriptor that asserts than an entry with | 129 /// Creates a new [PatternDescriptor] descriptor that asserts than an entry with |
131 /// a name matching [pattern] exists, and matches the [Descriptor] returned | 130 /// a name matching [pattern] exists, and matches the [Descriptor] returned |
132 /// by [fn]. | 131 /// by [fn]. |
133 PatternDescriptor pattern(Pattern name, EntryCreator fn) => | 132 PatternDescriptor pattern(Pattern name, EntryCreator fn) => |
134 new PatternDescriptor(name, fn); | 133 new PatternDescriptor(name, fn); |
135 | 134 |
136 /// A convenience method for creating a [PatternDescriptor] descriptor that | 135 /// A convenience method for creating a [PatternDescriptor] descriptor that |
137 /// constructs a [FileDescriptor] descriptor. | 136 /// constructs a [FileDescriptor] descriptor. |
138 PatternDescriptor filePattern(Pattern name, [String contents='']) => | 137 PatternDescriptor filePattern(Pattern name, [String contents='']) => |
139 pattern(name, (realName) => file(realName, contents)); | 138 pattern(name, (realName) => file(realName, contents)); |
140 | 139 |
141 /// A convenience method for creating a [PatternDescriptor] descriptor that | 140 /// A convenience method for creating a [PatternDescriptor] descriptor that |
142 /// constructs a [DirectoryDescriptor] descriptor. | 141 /// constructs a [DirectoryDescriptor] descriptor. |
143 PatternDescriptor dirPattern(Pattern name, [Iterable<Descriptor> contents]) => | 142 PatternDescriptor dirPattern(Pattern name, [Iterable<Descriptor> contents]) => |
144 pattern(name, (realName) => dir(realName, contents)); | 143 pattern(name, (realName) => dir(realName, contents)); |
OLD | NEW |