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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/pub_test.dart

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
OLDNEW
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library pub_tests; 1 library pub_tests;
6
7 import 'package:scheduled_test/scheduled_test.dart'; 2 import 'package:scheduled_test/scheduled_test.dart';
8
9 import '../lib/src/exit_codes.dart' as exit_codes; 3 import '../lib/src/exit_codes.dart' as exit_codes;
10 import 'test_pub.dart'; 4 import 'test_pub.dart';
11
12 final USAGE_STRING = """ 5 final USAGE_STRING = """
13 Pub is a package manager for Dart. 6 Pub is a package manager for Dart.
14 7
15 Usage: pub <command> [arguments] 8 Usage: pub <command> [arguments]
16 9
17 Global options: 10 Global options:
18 -h, --help Print this usage information. 11 -h, --help Print this usage information.
19 --version Print pub version. 12 --version Print pub version.
20 --[no-]trace Print debugging information when an error occurs. 13 --[no-]trace Print debugging information when an error occurs.
21 --verbosity Control output verbosity. 14 --verbosity Control output verbosity.
(...skipping 16 matching lines...) Expand all
38 publish Publish the current package to pub.dartlang.org. 31 publish Publish the current package to pub.dartlang.org.
39 run Run an executable from a package. 32 run Run an executable from a package.
40 serve Run a local web development server. 33 serve Run a local web development server.
41 upgrade Upgrade the current package's dependencies to latest versions. 34 upgrade Upgrade the current package's dependencies to latest versions.
42 uploader Manage uploaders for a package on pub.dartlang.org. 35 uploader Manage uploaders for a package on pub.dartlang.org.
43 version Print pub version. 36 version Print pub version.
44 37
45 Run "pub help [command]" for more information about a command. 38 Run "pub help [command]" for more information about a command.
46 See http://dartlang.org/tools/pub for detailed documentation. 39 See http://dartlang.org/tools/pub for detailed documentation.
47 """; 40 """;
48
49 final VERSION_STRING = ''' 41 final VERSION_STRING = '''
50 Pub 0.1.2+3 42 Pub 0.1.2+3
51 '''; 43 ''';
52
53 main() { 44 main() {
54 initConfig(); 45 initConfig();
55
56 integration('running pub with no command displays usage', () { 46 integration('running pub with no command displays usage', () {
57 schedulePub(args: [], output: USAGE_STRING); 47 schedulePub(args: [], output: USAGE_STRING);
58 }); 48 });
59
60 integration('running pub with just --help displays usage', () { 49 integration('running pub with just --help displays usage', () {
61 schedulePub(args: ['--help'], output: USAGE_STRING); 50 schedulePub(args: ['--help'], output: USAGE_STRING);
62 }); 51 });
63
64 integration('running pub with just -h displays usage', () { 52 integration('running pub with just -h displays usage', () {
65 schedulePub(args: ['-h'], output: USAGE_STRING); 53 schedulePub(args: ['-h'], output: USAGE_STRING);
66 }); 54 });
67
68 integration('running pub with --with-prejudice upcases everything', () { 55 integration('running pub with --with-prejudice upcases everything', () {
69 schedulePub(args: ['--with-prejudice'], output: USAGE_STRING.toUpperCase()); 56 schedulePub(args: ['--with-prejudice'], output: USAGE_STRING.toUpperCase());
70 }); 57 });
71
72 integration('running pub with --help after command shows command usage', () { 58 integration('running pub with --help after command shows command usage', () {
73 schedulePub(args: ['get', '--help'], 59 schedulePub(args: ['get', '--help'], output: '''
74 output: '''
75 Get the current package's dependencies. 60 Get the current package's dependencies.
76 61
77 Usage: pub get 62 Usage: pub get
78 -h, --help Print usage information for this command. 63 -h, --help Print usage information for this command.
79 --[no-]offline Use cached packages instead of accessing the net work. 64 --[no-]offline Use cached packages instead of accessing the net work.
80 -n, --dry-run Report what dependencies would change but don't change any. 65 -n, --dry-run Report what dependencies would change but don't change any.
81 66
82 Run "pub help" to see global options. 67 Run "pub help" to see global options.
83 See http://dartlang.org/tools/pub/cmd/pub-get.html for detailed docume ntation. 68 See http://dartlang.org/tools/pub/cmd/pub-get.html for detailed docume ntation.
84 '''); 69 ''');
85 }); 70 });
86
87 integration('running pub with -h after command shows command usage', () { 71 integration('running pub with -h after command shows command usage', () {
88 schedulePub(args: ['get', '-h'], 72 schedulePub(args: ['get', '-h'], output: '''
89 output: '''
90 Get the current package's dependencies. 73 Get the current package's dependencies.
91 74
92 Usage: pub get 75 Usage: pub get
93 -h, --help Print usage information for this command. 76 -h, --help Print usage information for this command.
94 --[no-]offline Use cached packages instead of accessing the net work. 77 --[no-]offline Use cached packages instead of accessing the net work.
95 -n, --dry-run Report what dependencies would change but don't change any. 78 -n, --dry-run Report what dependencies would change but don't change any.
96 79
97 Run "pub help" to see global options. 80 Run "pub help" to see global options.
98 See http://dartlang.org/tools/pub/cmd/pub-get.html for detailed docume ntation. 81 See http://dartlang.org/tools/pub/cmd/pub-get.html for detailed docume ntation.
99 '''); 82 ''');
100 }); 83 });
101 84 integration(
102 integration('running pub with --help after a command with subcommands shows ' 85 'running pub with --help after a command with subcommands shows '
103 'command usage', () { 86 'command usage',
104 schedulePub(args: ['cache', '--help'], 87 () {
105 output: ''' 88 schedulePub(args: ['cache', '--help'], output: '''
106 Work with the system cache. 89 Work with the system cache.
107 90
108 Usage: pub cache <subcommand> 91 Usage: pub cache <subcommand>
109 -h, --help Print usage information for this command. 92 -h, --help Print usage information for this command.
110 93
111 Available subcommands: 94 Available subcommands:
112 add Install a package. 95 add Install a package.
113 repair Reinstall cached packages. 96 repair Reinstall cached packages.
114 97
115 Run "pub help" to see global options. 98 Run "pub help" to see global options.
116 See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed docu mentation. 99 See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed docu mentation.
117 '''); 100 ''');
118 }); 101 });
119
120
121 integration('running pub with just --version displays version', () { 102 integration('running pub with just --version displays version', () {
122 schedulePub(args: ['--version'], output: VERSION_STRING); 103 schedulePub(args: ['--version'], output: VERSION_STRING);
123 }); 104 });
124
125 integration('an unknown command displays an error message', () { 105 integration('an unknown command displays an error message', () {
126 schedulePub(args: ['quylthulg'], 106 schedulePub(args: ['quylthulg'], error: '''
127 error: '''
128 Could not find a command named "quylthulg". 107 Could not find a command named "quylthulg".
129 108
130 Available commands: 109 Available commands:
131 build Apply transformers to build a package. 110 build Apply transformers to build a package.
132 cache Work with the system cache. 111 cache Work with the system cache.
133 deps Print package dependencies. 112 deps Print package dependencies.
134 downgrade Downgrade the current package's dependencies to oldest ver sions. 113 downgrade Downgrade the current package's dependencies to oldest ver sions.
135 get Get the current package's dependencies. 114 get Get the current package's dependencies.
136 global Work with global packages. 115 global Work with global packages.
137 help Display help information for Pub. 116 help Display help information for Pub.
138 publish Publish the current package to pub.dartlang.org. 117 publish Publish the current package to pub.dartlang.org.
139 run Run an executable from a package. 118 run Run an executable from a package.
140 serve Run a local web development server. 119 serve Run a local web development server.
141 upgrade Upgrade the current package's dependencies to latest versi ons. 120 upgrade Upgrade the current package's dependencies to latest versi ons.
142 uploader Manage uploaders for a package on pub.dartlang.org. 121 uploader Manage uploaders for a package on pub.dartlang.org.
143 version Print pub version. 122 version Print pub version.
144 ''', 123 ''', exitCode: exit_codes.USAGE);
145 exitCode: exit_codes.USAGE);
146 }); 124 });
147
148 integration('an unknown subcommand displays an error message', () { 125 integration('an unknown subcommand displays an error message', () {
149 schedulePub(args: ['cache', 'quylthulg'], 126 schedulePub(args: ['cache', 'quylthulg'], error: '''
150 error: '''
151 Could not find a subcommand named "quylthulg" for "pub cache". 127 Could not find a subcommand named "quylthulg" for "pub cache".
152 128
153 Usage: pub cache <subcommand> 129 Usage: pub cache <subcommand>
154 -h, --help Print usage information for this command. 130 -h, --help Print usage information for this command.
155 131
156 Available subcommands: 132 Available subcommands:
157 add Install a package. 133 add Install a package.
158 repair Reinstall cached packages. 134 repair Reinstall cached packages.
159 135
160 Run "pub help" to see global options. 136 Run "pub help" to see global options.
161 See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed docume ntation. 137 See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed docume ntation.
162 ''', 138 ''', exitCode: exit_codes.USAGE);
163 exitCode: exit_codes.USAGE);
164 }); 139 });
165
166 integration('an unknown option displays an error message', () { 140 integration('an unknown option displays an error message', () {
167 schedulePub(args: ['--blorf'], 141 schedulePub(args: ['--blorf'], error: '''
168 error: '''
169 Could not find an option named "blorf". 142 Could not find an option named "blorf".
170 Run "pub help" to see available options. 143 Run "pub help" to see available options.
171 ''', 144 ''', exitCode: exit_codes.USAGE);
172 exitCode: exit_codes.USAGE);
173 }); 145 });
174
175 integration('an unknown command option displays an error message', () { 146 integration('an unknown command option displays an error message', () {
176 // TODO(rnystrom): When pub has command-specific options, a more precise 147 schedulePub(args: ['version', '--blorf'], error: '''
177 // error message would be good here.
178 schedulePub(args: ['version', '--blorf'],
179 error: '''
180 Could not find an option named "blorf". 148 Could not find an option named "blorf".
181 Run "pub help" to see available options. 149 Run "pub help" to see available options.
182 ''', 150 ''', exitCode: exit_codes.USAGE);
183 exitCode: exit_codes.USAGE);
184 }); 151 });
185
186 integration('an unexpected argument displays an error message', () { 152 integration('an unexpected argument displays an error message', () {
187 schedulePub(args: ['version', 'unexpected'], 153 schedulePub(args: ['version', 'unexpected'], error: '''
188 error: '''
189 Command "version" does not take any arguments. 154 Command "version" does not take any arguments.
190 155
191 Usage: pub version 156 Usage: pub version
192 -h, --help Print usage information for this command. 157 -h, --help Print usage information for this command.
193 158
194 Run "pub help" to see global options. 159 Run "pub help" to see global options.
195 ''', 160 ''', exitCode: exit_codes.USAGE);
196 exitCode: exit_codes.USAGE);
197 }); 161 });
198
199 integration('a missing subcommand displays an error message', () { 162 integration('a missing subcommand displays an error message', () {
200 schedulePub(args: ['cache'], 163 schedulePub(args: ['cache'], error: '''
201 error: '''
202 Missing subcommand for "pub cache". 164 Missing subcommand for "pub cache".
203 165
204 Usage: pub cache <subcommand> 166 Usage: pub cache <subcommand>
205 -h, --help Print usage information for this command. 167 -h, --help Print usage information for this command.
206 168
207 Available subcommands: 169 Available subcommands:
208 add Install a package. 170 add Install a package.
209 repair Reinstall cached packages. 171 repair Reinstall cached packages.
210 172
211 Run "pub help" to see global options. 173 Run "pub help" to see global options.
212 See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed docume ntation. 174 See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed docume ntation.
213 ''', 175 ''', exitCode: exit_codes.USAGE);
214 exitCode: exit_codes.USAGE);
215 }); 176 });
216
217 group('help', () { 177 group('help', () {
218 integration('shows global help if no command is given', () { 178 integration('shows global help if no command is given', () {
219 schedulePub(args: ['help'], output: USAGE_STRING); 179 schedulePub(args: ['help'], output: USAGE_STRING);
220 }); 180 });
221
222 integration('shows help for a command', () { 181 integration('shows help for a command', () {
223 schedulePub(args: ['help', 'get'], 182 schedulePub(args: ['help', 'get'], output: '''
224 output: '''
225 Get the current package's dependencies. 183 Get the current package's dependencies.
226 184
227 Usage: pub get 185 Usage: pub get
228 -h, --help Print usage information for this command. 186 -h, --help Print usage information for this command.
229 --[no-]offline Use cached packages instead of accessing the n etwork. 187 --[no-]offline Use cached packages instead of accessing the n etwork.
230 -n, --dry-run Report what dependencies would change but don' t change any. 188 -n, --dry-run Report what dependencies would change but don' t change any.
231 189
232 Run "pub help" to see global options. 190 Run "pub help" to see global options.
233 See http://dartlang.org/tools/pub/cmd/pub-get.html for detailed docu mentation. 191 See http://dartlang.org/tools/pub/cmd/pub-get.html for detailed docu mentation.
234 '''); 192 ''');
235 }); 193 });
236
237 integration('shows help for a command', () { 194 integration('shows help for a command', () {
238 schedulePub(args: ['help', 'publish'], 195 schedulePub(args: ['help', 'publish'], output: '''
239 output: '''
240 Publish the current package to pub.dartlang.org. 196 Publish the current package to pub.dartlang.org.
241 197
242 Usage: pub publish [options] 198 Usage: pub publish [options]
243 -h, --help Print usage information for this command. 199 -h, --help Print usage information for this command.
244 -n, --dry-run Validate but do not publish the package. 200 -n, --dry-run Validate but do not publish the package.
245 -f, --force Publish without confirmation if there are no errors . 201 -f, --force Publish without confirmation if there are no errors .
246 --server The package server to which to upload this package. 202 --server The package server to which to upload this package.
247 (defaults to "https://pub.dartlang.org") 203 (defaults to "https://pub.dartlang.org")
248 204
249 Run "pub help" to see global options. 205 Run "pub help" to see global options.
250 See http://dartlang.org/tools/pub/cmd/pub-lish.html for detailed doc umentation. 206 See http://dartlang.org/tools/pub/cmd/pub-lish.html for detailed doc umentation.
251 '''); 207 ''');
252 }); 208 });
253
254 integration('shows non-truncated help', () { 209 integration('shows non-truncated help', () {
255 schedulePub(args: ['help', 'serve'], 210 schedulePub(args: ['help', 'serve'], output: '''
256 output: '''
257 Run a local web development server. 211 Run a local web development server.
258 212
259 By default, this serves "web/" and "test/", but an explicit list of 213 By default, this serves "web/" and "test/", but an explicit list of
260 directories to serve can be provided as well. 214 directories to serve can be provided as well.
261 215
262 Usage: pub serve [directories...] 216 Usage: pub serve [directories...]
263 -h, --help Print usage information for this command. 217 -h, --help Print usage information for this command.
264 --mode Mode to run transformers in. 218 --mode Mode to run transformers in.
265 (defaults to "debug") 219 (defaults to "debug")
266 220
267 --all Use all default source directories. 221 --all Use all default source directories.
268 --hostname The hostname to listen on. 222 --hostname The hostname to listen on.
269 (defaults to "localhost") 223 (defaults to "localhost")
270 224
271 --port The base port to listen on. 225 --port The base port to listen on.
272 (defaults to "8080") 226 (defaults to "8080")
273 227
274 --[no-]dart2js Compile Dart to JavaScript. 228 --[no-]dart2js Compile Dart to JavaScript.
275 (defaults to on) 229 (defaults to on)
276 230
277 --[no-]force-poll Force the use of a polling filesystem watch er. 231 --[no-]force-poll Force the use of a polling filesystem watch er.
278 232
279 Run "pub help" to see global options. 233 Run "pub help" to see global options.
280 See http://dartlang.org/tools/pub/cmd/pub-serve.html for detailed do cumentation. 234 See http://dartlang.org/tools/pub/cmd/pub-serve.html for detailed do cumentation.
281 '''); 235 ''');
282 }); 236 });
283
284 integration('shows help for a subcommand', () { 237 integration('shows help for a subcommand', () {
285 schedulePub(args: ['help', 'cache', 'list'], 238 schedulePub(args: ['help', 'cache', 'list'], output: '''
286 output: '''
287 List packages in the system cache. 239 List packages in the system cache.
288 240
289 Usage: pub cache list 241 Usage: pub cache list
290 -h, --help Print usage information for this command. 242 -h, --help Print usage information for this command.
291 243
292 Run "pub help" to see global options. 244 Run "pub help" to see global options.
293 '''); 245 ''');
294 }); 246 });
295
296 integration('an unknown help command displays an error message', () { 247 integration('an unknown help command displays an error message', () {
297 schedulePub(args: ['help', 'quylthulg'], 248 schedulePub(args: ['help', 'quylthulg'], error: '''
298 error: '''
299 Could not find a command named "quylthulg". 249 Could not find a command named "quylthulg".
300 250
301 Available commands: 251 Available commands:
302 build Apply transformers to build a package. 252 build Apply transformers to build a package.
303 cache Work with the system cache. 253 cache Work with the system cache.
304 deps Print package dependencies. 254 deps Print package dependencies.
305 downgrade Downgrade the current package's dependencies to oldest versions. 255 downgrade Downgrade the current package's dependencies to oldest versions.
306 get Get the current package's dependencies. 256 get Get the current package's dependencies.
307 global Work with global packages. 257 global Work with global packages.
308 help Display help information for Pub. 258 help Display help information for Pub.
309 publish Publish the current package to pub.dartlang.org. 259 publish Publish the current package to pub.dartlang.org.
310 run Run an executable from a package. 260 run Run an executable from a package.
311 serve Run a local web development server. 261 serve Run a local web development server.
312 upgrade Upgrade the current package's dependencies to latest v ersions. 262 upgrade Upgrade the current package's dependencies to latest v ersions.
313 uploader Manage uploaders for a package on pub.dartlang.org. 263 uploader Manage uploaders for a package on pub.dartlang.org.
314 version Print pub version. 264 version Print pub version.
315 ''', 265 ''', exitCode: exit_codes.USAGE);
316 exitCode: exit_codes.USAGE);
317 }); 266 });
318
319 integration('an unknown help subcommand displays an error message', () { 267 integration('an unknown help subcommand displays an error message', () {
320 schedulePub(args: ['help', 'cache', 'quylthulg'], 268 schedulePub(args: ['help', 'cache', 'quylthulg'], error: '''
321 error: '''
322 Could not find a subcommand named "quylthulg" for "pub cache". 269 Could not find a subcommand named "quylthulg" for "pub cache".
323 270
324 Usage: pub cache <subcommand> 271 Usage: pub cache <subcommand>
325 -h, --help Print usage information for this command. 272 -h, --help Print usage information for this command.
326 273
327 Available subcommands: 274 Available subcommands:
328 add Install a package. 275 add Install a package.
329 repair Reinstall cached packages. 276 repair Reinstall cached packages.
330 277
331 Run "pub help" to see global options. 278 Run "pub help" to see global options.
332 See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed do cumentation. 279 See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed do cumentation.
333 ''', 280 ''', exitCode: exit_codes.USAGE);
334 exitCode: exit_codes.USAGE);
335 }); 281 });
336
337 integration('an unexpected help subcommand displays an error message', () { 282 integration('an unexpected help subcommand displays an error message', () {
338 schedulePub(args: ['help', 'version', 'badsubcommand'], 283 schedulePub(args: ['help', 'version', 'badsubcommand'], error: '''
339 error: '''
340 Command "pub version" does not expect a subcommand. 284 Command "pub version" does not expect a subcommand.
341 285
342 Usage: pub version 286 Usage: pub version
343 -h, --help Print usage information for this command. 287 -h, --help Print usage information for this command.
344 288
345 Run "pub help" to see global options. 289 Run "pub help" to see global options.
346 ''', 290 ''', exitCode: exit_codes.USAGE);
347 exitCode: exit_codes.USAGE);
348 }); 291 });
349 }); 292 });
350
351 group('version', () { 293 group('version', () {
352 integration('displays the current version', () { 294 integration('displays the current version', () {
353 schedulePub(args: ['version'], output: VERSION_STRING); 295 schedulePub(args: ['version'], output: VERSION_STRING);
354 }); 296 });
355 }); 297 });
356 } 298 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698