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

Side by Side Diff: pkg/scheduled_test/test/descriptor/pattern_test.dart

Issue 812253002: Delete a bunch of packages that are now on GitHub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Un-delete http Created 6 years 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:scheduled_test/descriptor.dart' as d;
6 import 'package:scheduled_test/scheduled_test.dart';
7
8 import 'package:metatest/metatest.dart';
9 import 'utils.dart';
10
11 String sandbox;
12
13 void main() => initTests(_test);
14
15 void _test(message) {
16 initMetatest(message);
17
18 setUpTimeout();
19
20 expectTestsPass("pattern().validate() succeeds if there's a file matching "
21 "the pattern and the child entry", () {
22 test('test', () {
23 scheduleSandbox();
24
25 d.file('foo', 'blap').create();
26
27 d.filePattern(new RegExp(r'f..'), 'blap').validate();
28 });
29 });
30
31 expectTestsPass("pattern().validate() succeeds if there's a dir matching "
32 "the pattern and the child entry", () {
33 test('test', () {
34 scheduleSandbox();
35
36 d.dir('foo', [
37 d.file('bar', 'baz')
38 ]).create();
39
40 d.dirPattern(new RegExp(r'f..'), [
41 d.file('bar', 'baz')
42 ]).validate();
43 });
44 });
45
46 expectTestsPass("pattern().validate() succeeds if there's multiple files "
47 "matching the pattern but only one matching the child entry", () {
48 test('test', () {
49 scheduleSandbox();
50
51 d.file('foo', 'blap').create();
52 d.file('fee', 'blak').create();
53 d.file('faa', 'blut').create();
54
55 d.filePattern(new RegExp(r'f..'), 'blap').validate();
56 });
57 });
58
59 expectTestsPass("pattern().validate() fails if there's no file matching the "
60 "pattern", () {
61 var errors;
62 test('test 1', () {
63 scheduleSandbox();
64
65 currentSchedule.onException.schedule(() {
66 errors = currentSchedule.errors;
67 });
68
69 d.filePattern(new RegExp(r'f..'), 'bar').validate();
70 });
71
72 test('test 2', () {
73 expect(errors.single, new isInstanceOf<ScheduleError>());
74 expect(errors.single.error.toString(),
75 matches(r"^No entry found in '[^']+' matching /f\.\./\.$"));
76 });
77 }, passing: ['test 2']);
78
79 expectTestsPass("pattern().validate() fails if there's a file matching the "
80 "pattern but not the entry", () {
81 var errors;
82 test('test 1', () {
83 scheduleSandbox();
84
85 currentSchedule.onException.schedule(() {
86 errors = currentSchedule.errors;
87 });
88
89 d.file('foo', 'bap').create();
90 d.filePattern(new RegExp(r'f..'), 'bar').validate();
91 });
92
93 test('test 2', () {
94 expect(errors.single, new isInstanceOf<ScheduleError>());
95 expect(errors.single.error.toString(),
96 matches(r"^Caught error\n"
97 r"| File 'foo' should contain:\n"
98 r"| | bar\n"
99 r"| but actually contained:\n"
100 r"| X bap\n"
101 r"while validating\n"
102 r"| foo$"));
103 });
104 }, passing: ['test 2']);
105
106 expectTestsPass("pattern().validate() fails if there's a dir matching the "
107 "pattern but not the entry", () {
108 var errors;
109 test('test 1', () {
110 scheduleSandbox();
111
112 currentSchedule.onException.schedule(() {
113 errors = currentSchedule.errors;
114 });
115
116 d.dir('foo', [
117 d.file('bar', 'bap')
118 ]).create();
119
120 d.dirPattern(new RegExp(r'f..'), [
121 d.file('bar', 'baz')
122 ]).validate();
123 });
124
125 test('test 2', () {
126 expect(errors.single, new isInstanceOf<ScheduleError>());
127 expect(errors.single.error.toString(),
128 matches(r"^Caught error\n"
129 r"| File 'bar' should contain:\n"
130 r"| | baz\n"
131 r"| but actually contained:\n"
132 r"| X bap"
133 r"while validating\n"
134 r"| foo\n"
135 r"| '-- bar$"));
136 });
137 }, passing: ['test 2']);
138
139 expectTestsPass("pattern().validate() fails if there's multiple files "
140 "matching the pattern and the child entry", () {
141 var errors;
142 test('test 1', () {
143 scheduleSandbox();
144
145 currentSchedule.onException.schedule(() {
146 errors = currentSchedule.errors;
147 });
148
149 d.file('foo', 'bar').create();
150 d.file('fee', 'bar').create();
151 d.file('faa', 'bar').create();
152 d.filePattern(new RegExp(r'f..'), 'bar').validate();
153 });
154
155 test('test 2', () {
156 expect(errors.single, new isInstanceOf<ScheduleError>());
157 expect(errors.single.error.toString(), matches(
158 r"^Multiple valid entries found in '[^']+' matching "
159 r"\/f\.\./:\n"
160 r"\* faa\n"
161 r"\* fee\n"
162 r"\* foo$"));
163 });
164 }, passing: ['test 2']);
165 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/test/descriptor/nothing_test.dart ('k') | pkg/scheduled_test/test/descriptor/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698