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

Side by Side Diff: pkg/scheduled_test/lib/descriptor.dart

Issue 172493003: pkg/scheduled_test: fix example in docs to be 100% valid (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 /// assertion that that structure exists. For example: 11 /// assertion that that structure exists. For example:
12 /// 12 ///
13 /// import 'dart:io';
Bob Nystrom 2014/02/19 18:17:28 Nit, but can you add a blank line after this impor
kevmoo 2014/02/19 21:53:12 Done.
13 /// import 'package:scheduled_test/descriptor.dart' as d; 14 /// import 'package:scheduled_test/descriptor.dart' as d;
14 /// import 'package:scheduled_test/scheduled_test.dart'; 15 /// import 'package:scheduled_test/scheduled_test.dart';
15 /// 16 ///
16 /// void main() { 17 /// void main() {
17 /// test('Directory.rename', () { 18 /// test('Directory.rename', () {
18 /// d.dir('parent', [ 19 /// d.dir('parent', [
19 /// d.file('sibling', 'sibling-contents'), 20 /// d.file('sibling', 'sibling-contents'),
20 /// d.dir('old-name', [ 21 /// d.dir('old-name', [
21 /// d.file('child', 'child-contents') 22 /// d.file('child', 'child-contents')
22 /// ]) 23 /// ])
23 /// ]).create(); 24 /// ]).create();
24 /// 25 ///
25 /// schedule(() => 26 /// schedule(() =>
26 /// new Directory('parent/old-name').rename('parent/new-name')); 27 /// new Directory('parent/old-name').rename('parent/new-name'));
27 /// 28 ///
28 /// d.dir('parent', [ 29 /// d.dir('parent', [
29 /// d.file('sibling', 'sibling-contents'), 30 /// d.file('sibling', 'sibling-contents'),
30 /// d.dir('new-name', [ 31 /// d.dir('new-name', [
31 /// d.file('child', 'child-contents') 32 /// d.file('child', 'child-contents')
32 /// ]) 33 /// ])
33 /// ]).validate(); 34 /// ]).validate();
34 /// }) 35 /// });
35 /// } 36 /// }
36 /// 37 ///
37 /// Usually you don't want your tests cluttering up your working directory with 38 /// Usually you don't want your tests cluttering up your working directory with
38 /// fake filesystem entities. You can set [defaultRoot] to configure where 39 /// fake filesystem entities. You can set [defaultRoot] to configure where
39 /// filesystem descriptors are rooted on the physical filesystem. For example, 40 /// filesystem descriptors are rooted on the physical filesystem. For example,
40 /// to create a temporary directory for each test: 41 /// to create a temporary directory for each test:
41 /// 42 ///
42 /// import 'package:scheduled_test/descriptor.dart' as d; 43 /// import 'package:scheduled_test/descriptor.dart' as d;
43 /// import 'package:scheduled_test/scheduled_test.dart'; 44 /// import 'package:scheduled_test/scheduled_test.dart';
44 /// 45 ///
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 136
136 /// A convenience method for creating a [PatternDescriptor] descriptor that 137 /// A convenience method for creating a [PatternDescriptor] descriptor that
137 /// constructs a [FileDescriptor] descriptor. 138 /// constructs a [FileDescriptor] descriptor.
138 PatternDescriptor filePattern(Pattern name, [String contents='']) => 139 PatternDescriptor filePattern(Pattern name, [String contents='']) =>
139 pattern(name, (realName) => file(realName, contents)); 140 pattern(name, (realName) => file(realName, contents));
140 141
141 /// A convenience method for creating a [PatternDescriptor] descriptor that 142 /// A convenience method for creating a [PatternDescriptor] descriptor that
142 /// constructs a [DirectoryDescriptor] descriptor. 143 /// constructs a [DirectoryDescriptor] descriptor.
143 PatternDescriptor dirPattern(Pattern name, [Iterable<Descriptor> contents]) => 144 PatternDescriptor dirPattern(Pattern name, [Iterable<Descriptor> contents]) =>
144 pattern(name, (realName) => dir(realName, contents)); 145 pattern(name, (realName) => dir(realName, contents));
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698