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

Side by Side Diff: utils/tests/pub/install/pub_install_test.dart

Issue 11369210: Make RegExp constructor non-const. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up status files. Created 8 years, 1 month 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library pub_tests; 5 library pub_tests;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import '../test_pub.dart'; 9 import '../test_pub.dart';
10 import '../../../../pkg/unittest/lib/unittest.dart'; 10 import '../../../../pkg/unittest/lib/unittest.dart';
11 11
12 main() { 12 main() {
13 group('requires', () { 13 group('requires', () {
14 test('a pubspec', () { 14 test('a pubspec', () {
15 dir(appPath, []).scheduleCreate(); 15 dir(appPath, []).scheduleCreate();
16 16
17 schedulePub(args: ['install'], 17 schedulePub(args: ['install'],
18 error: const RegExp(r'^Could not find a file named "pubspec\.yaml"'), 18 error: new RegExp(r'^Could not find a file named "pubspec\.yaml"'),
19 exitCode: 1); 19 exitCode: 1);
20 20
21 run(); 21 run();
22 }); 22 });
23 23
24 test('a pubspec with a "name" key', () { 24 test('a pubspec with a "name" key', () {
25 dir(appPath, [ 25 dir(appPath, [
26 pubspec({"dependencies": {"foo": null}}) 26 pubspec({"dependencies": {"foo": null}})
27 ]).scheduleCreate(); 27 ]).scheduleCreate();
28 28
29 schedulePub(args: ['install'], 29 schedulePub(args: ['install'],
30 error: const RegExp(r'^pubspec.yaml is missing the required "name" ' 30 error: new RegExp(r'^pubspec.yaml is missing the required "name" '
31 r'field \(e\.g\. "name: myapp"\)\.'), 31 r'field \(e\.g\. "name: myapp"\)\.'),
32 exitCode: 1); 32 exitCode: 1);
33 33
34 run(); 34 run();
35 }); 35 });
36 }); 36 });
37 37
38 test('adds itself to the packages', () { 38 test('adds itself to the packages', () {
39 // The symlink should use the name in the pubspec, not the name of the 39 // The symlink should use the name in the pubspec, not the name of the
40 // directory. 40 // directory.
41 dir(appPath, [ 41 dir(appPath, [
42 pubspec({"name": "myapp_name"}), 42 pubspec({"name": "myapp_name"}),
43 libDir('foo'), 43 libDir('foo'),
44 ]).scheduleCreate(); 44 ]).scheduleCreate();
45 45
46 schedulePub(args: ['install'], 46 schedulePub(args: ['install'],
47 output: const RegExp(r"Dependencies installed!$")); 47 output: new RegExp(r"Dependencies installed!$"));
48 48
49 dir(packagesPath, [ 49 dir(packagesPath, [
50 dir("myapp_name", [ 50 dir("myapp_name", [
51 file('foo.dart', 'main() => "foo";') 51 file('foo.dart', 'main() => "foo";')
52 ]) 52 ])
53 ]).scheduleValidate(); 53 ]).scheduleValidate();
54 54
55 run(); 55 run();
56 }); 56 });
57 57
58 test('does not adds itself to the packages if it has no "lib" directory', () { 58 test('does not adds itself to the packages if it has no "lib" directory', () {
59 // The symlink should use the name in the pubspec, not the name of the 59 // The symlink should use the name in the pubspec, not the name of the
60 // directory. 60 // directory.
61 dir(appPath, [ 61 dir(appPath, [
62 pubspec({"name": "myapp_name"}), 62 pubspec({"name": "myapp_name"}),
63 ]).scheduleCreate(); 63 ]).scheduleCreate();
64 64
65 schedulePub(args: ['install'], 65 schedulePub(args: ['install'],
66 output: const RegExp(r"Dependencies installed!$")); 66 output: new RegExp(r"Dependencies installed!$"));
67 67
68 dir(packagesPath, [ 68 dir(packagesPath, [
69 nothing("myapp_name") 69 nothing("myapp_name")
70 ]).scheduleValidate(); 70 ]).scheduleValidate();
71 71
72 run(); 72 run();
73 }); 73 });
74 74
75 test('does not add a package if it does not have a "lib" directory', () { 75 test('does not add a package if it does not have a "lib" directory', () {
76 // Using an SDK source, but this should be true of all sources. 76 // Using an SDK source, but this should be true of all sources.
77 dir(sdkPath, [ 77 dir(sdkPath, [
78 file('revision', '1234'), 78 file('revision', '1234'),
79 dir('pkg', [ 79 dir('pkg', [
80 dir('foo', [ 80 dir('foo', [
81 libPubspec('foo', '0.0.0-not.used') 81 libPubspec('foo', '0.0.0-not.used')
82 ]) 82 ])
83 ]) 83 ])
84 ]).scheduleCreate(); 84 ]).scheduleCreate();
85 85
86 dir(appPath, [ 86 dir(appPath, [
87 pubspec({"name": "myapp", "dependencies": {"foo": {"sdk": "foo"}}}) 87 pubspec({"name": "myapp", "dependencies": {"foo": {"sdk": "foo"}}})
88 ]).scheduleCreate(); 88 ]).scheduleCreate();
89 89
90 schedulePub(args: ['install'], 90 schedulePub(args: ['install'],
91 error: const RegExp(r'Warning: Package "foo" does not have a "lib" ' 91 error: new RegExp(r'Warning: Package "foo" does not have a "lib" '
92 'directory.'), 92 'directory.'),
93 output: const RegExp(r"Dependencies installed!$")); 93 output: new RegExp(r"Dependencies installed!$"));
94 94
95 run(); 95 run();
96 }); 96 });
97 97
98 test('does not warn if the root package lacks a "lib" directory', () { 98 test('does not warn if the root package lacks a "lib" directory', () {
99 dir(appPath, [ 99 dir(appPath, [
100 appPubspec([]) 100 appPubspec([])
101 ]).scheduleCreate(); 101 ]).scheduleCreate();
102 102
103 schedulePub(args: ['install'], 103 schedulePub(args: ['install'],
104 error: '', 104 error: '',
105 output: const RegExp(r"Dependencies installed!$")); 105 output: new RegExp(r"Dependencies installed!$"));
106 106
107 run(); 107 run();
108 }); 108 });
109 109
110 test('overwrites the existing packages directory', () { 110 test('overwrites the existing packages directory', () {
111 dir(appPath, [ 111 dir(appPath, [
112 appPubspec([]), 112 appPubspec([]),
113 dir('packages', [ 113 dir('packages', [
114 dir('foo'), 114 dir('foo'),
115 dir('myapp'), 115 dir('myapp'),
116 ]), 116 ]),
117 libDir('myapp') 117 libDir('myapp')
118 ]).scheduleCreate(); 118 ]).scheduleCreate();
119 119
120 schedulePub(args: ['install'], 120 schedulePub(args: ['install'],
121 output: const RegExp(r"Dependencies installed!$")); 121 output: new RegExp(r"Dependencies installed!$"));
122 122
123 dir(packagesPath, [ 123 dir(packagesPath, [
124 nothing('foo'), 124 nothing('foo'),
125 dir('myapp', [file('myapp.dart', 'main() => "myapp";')]) 125 dir('myapp', [file('myapp.dart', 'main() => "myapp";')])
126 ]).scheduleValidate(); 126 ]).scheduleValidate();
127 127
128 run(); 128 run();
129 }); 129 });
130 130
131 group('creates a packages directory in', () { 131 group('creates a packages directory in', () {
132 test('"test/" and its subdirectories', () { 132 test('"test/" and its subdirectories', () {
133 dir(appPath, [ 133 dir(appPath, [
134 appPubspec([]), 134 appPubspec([]),
135 libDir('foo'), 135 libDir('foo'),
136 dir("test", [dir("subtest")]) 136 dir("test", [dir("subtest")])
137 ]).scheduleCreate(); 137 ]).scheduleCreate();
138 138
139 schedulePub(args: ['install'], 139 schedulePub(args: ['install'],
140 output: const RegExp(r"Dependencies installed!$")); 140 output: new RegExp(r"Dependencies installed!$"));
141 141
142 dir(appPath, [ 142 dir(appPath, [
143 dir("test", [ 143 dir("test", [
144 dir("packages", [ 144 dir("packages", [
145 dir("myapp", [ 145 dir("myapp", [
146 file('foo.dart', 'main() => "foo";') 146 file('foo.dart', 'main() => "foo";')
147 ]) 147 ])
148 ]), 148 ]),
149 dir("subtest", [ 149 dir("subtest", [
150 dir("packages", [ 150 dir("packages", [
151 dir("myapp", [ 151 dir("myapp", [
152 file('foo.dart', 'main() => "foo";') 152 file('foo.dart', 'main() => "foo";')
153 ]) 153 ])
154 ]) 154 ])
155 ]) 155 ])
156 ]) 156 ])
157 ]).scheduleValidate(); 157 ]).scheduleValidate();
158 158
159 run(); 159 run();
160 }); 160 });
161 161
162 test('"example/" and its subdirectories', () { 162 test('"example/" and its subdirectories', () {
163 dir(appPath, [ 163 dir(appPath, [
164 appPubspec([]), 164 appPubspec([]),
165 libDir('foo'), 165 libDir('foo'),
166 dir("example", [dir("subexample")]) 166 dir("example", [dir("subexample")])
167 ]).scheduleCreate(); 167 ]).scheduleCreate();
168 168
169 schedulePub(args: ['install'], 169 schedulePub(args: ['install'],
170 output: const RegExp(r"Dependencies installed!$")); 170 output: new RegExp(r"Dependencies installed!$"));
171 171
172 dir(appPath, [ 172 dir(appPath, [
173 dir("example", [ 173 dir("example", [
174 dir("packages", [ 174 dir("packages", [
175 dir("myapp", [ 175 dir("myapp", [
176 file('foo.dart', 'main() => "foo";') 176 file('foo.dart', 'main() => "foo";')
177 ]) 177 ])
178 ]), 178 ]),
179 dir("subexample", [ 179 dir("subexample", [
180 dir("packages", [ 180 dir("packages", [
181 dir("myapp", [ 181 dir("myapp", [
182 file('foo.dart', 'main() => "foo";') 182 file('foo.dart', 'main() => "foo";')
183 ]) 183 ])
184 ]) 184 ])
185 ]) 185 ])
186 ]) 186 ])
187 ]).scheduleValidate(); 187 ]).scheduleValidate();
188 188
189 run(); 189 run();
190 }); 190 });
191 191
192 test('"web/" and its subdirectories', () { 192 test('"web/" and its subdirectories', () {
193 dir(appPath, [ 193 dir(appPath, [
194 appPubspec([]), 194 appPubspec([]),
195 libDir('foo'), 195 libDir('foo'),
196 dir("web", [dir("subweb")]) 196 dir("web", [dir("subweb")])
197 ]).scheduleCreate(); 197 ]).scheduleCreate();
198 198
199 schedulePub(args: ['install'], 199 schedulePub(args: ['install'],
200 output: const RegExp(r"Dependencies installed!$")); 200 output: new RegExp(r"Dependencies installed!$"));
201 201
202 dir(appPath, [ 202 dir(appPath, [
203 dir("web", [ 203 dir("web", [
204 dir("packages", [ 204 dir("packages", [
205 dir("myapp", [ 205 dir("myapp", [
206 file('foo.dart', 'main() => "foo";') 206 file('foo.dart', 'main() => "foo";')
207 ]) 207 ])
208 ]), 208 ]),
209 dir("subweb", [ 209 dir("subweb", [
210 dir("packages", [ 210 dir("packages", [
211 dir("myapp", [ 211 dir("myapp", [
212 file('foo.dart', 'main() => "foo";') 212 file('foo.dart', 'main() => "foo";')
213 ]) 213 ])
214 ]) 214 ])
215 ]) 215 ])
216 ]) 216 ])
217 ]).scheduleValidate(); 217 ]).scheduleValidate();
218 218
219 run(); 219 run();
220 }); 220 });
221 221
222 test('"bin/"', () { 222 test('"bin/"', () {
223 dir(appPath, [ 223 dir(appPath, [
224 appPubspec([]), 224 appPubspec([]),
225 libDir('foo'), 225 libDir('foo'),
226 dir("bin") 226 dir("bin")
227 ]).scheduleCreate(); 227 ]).scheduleCreate();
228 228
229 schedulePub(args: ['install'], 229 schedulePub(args: ['install'],
230 output: const RegExp(r"Dependencies installed!$")); 230 output: new RegExp(r"Dependencies installed!$"));
231 231
232 dir(appPath, [ 232 dir(appPath, [
233 dir("bin", [ 233 dir("bin", [
234 dir("packages", [ 234 dir("packages", [
235 dir("myapp", [ 235 dir("myapp", [
236 file('foo.dart', 'main() => "foo";') 236 file('foo.dart', 'main() => "foo";')
237 ]) 237 ])
238 ]) 238 ])
239 ]) 239 ])
240 ]).scheduleValidate(); 240 ]).scheduleValidate();
241 241
242 run(); 242 run();
243 }); 243 });
244 }); 244 });
245 245
246 // TODO(rnystrom): Remove this when old layout support is removed. (#4964) 246 // TODO(rnystrom): Remove this when old layout support is removed. (#4964)
247 test('shows a warning if the entrypoint uses the old layout', () { 247 test('shows a warning if the entrypoint uses the old layout', () {
248 // The symlink should use the name in the pubspec, not the name of the 248 // The symlink should use the name in the pubspec, not the name of the
249 // directory. 249 // directory.
250 dir(appPath, [ 250 dir(appPath, [
251 pubspec({"name": "myapp_name"}), 251 pubspec({"name": "myapp_name"}),
252 file("foo.dart", 'main() => "foo";'), 252 file("foo.dart", 'main() => "foo";'),
253 ]).scheduleCreate(); 253 ]).scheduleCreate();
254 254
255 schedulePub(args: ['install'], 255 schedulePub(args: ['install'],
256 error: ''' 256 error: '''
257 Warning: Package "myapp_name" is using a deprecated layout. 257 Warning: Package "myapp_name" is using a deprecated layout.
258 See http://www.dartlang.org/docs/pub-package-manager/package-layout.html for details. 258 See http://www.dartlang.org/docs/pub-package-manager/package-layout.html for details.
259 ''', 259 ''',
260 output: const RegExp(r"Dependencies installed!$")); 260 output: new RegExp(r"Dependencies installed!$"));
261 261
262 run(); 262 run();
263 }); 263 });
264 } 264 }
OLDNEW
« no previous file with comments | « utils/tests/pub/install/hosted/unlock_if_new_is_unsatisfied_test.dart ('k') | utils/tests/pub/install/sdk/check_out_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698