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

Side by Side Diff: sdk/lib/_internal/pub/test/pub_cache_test.dart

Issue 138723005: Support subcommands in pub and pub help. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Infer hiddenness from subcommands. 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
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 library pub_cache_test; 5 library pub_cache_test;
6 6
7 import 'package:path/path.dart' as path; 7 import 'package:path/path.dart' as path;
8 8
9 import 'descriptor.dart' as d; 9 import 'descriptor.dart' as d;
10 import 'test_pub.dart'; 10 import 'test_pub.dart';
11 11
12 main() { 12 main() {
13 initConfig(); 13 initConfig();
14 14
15 hostedDir(package) { 15 hostedDir(package) {
16 return path.join(sandboxDir, cachePath, "hosted", 16 return path.join(sandboxDir, cachePath, "hosted",
17 "pub.dartlang.org", package); 17 "pub.dartlang.org", package);
18 } 18 }
19 19
20 integration('running pub cache displays error message', () {
21 schedulePub(args: ['cache'],
22 output: '''
23 Inspect the system cache.
24
25 Usage: pub cache list
26 -h, --help Print usage information for this command.
27 ''',
28 error: 'The cache command expects one argument.',
29 exitCode: 64);
30 });
31
32 integration('running pub cache foo displays error message', () {
33 schedulePub(args: ['cache' ,'foo'],
34 output: '''
35 Inspect the system cache.
36
37 Usage: pub cache list
38 -h, --help Print usage information for this command.
39 ''',
40 error: 'Unknown cache command "foo".',
41 exitCode: 64);
42 });
43
44 integration('running pub cache list when there is no cache', () { 20 integration('running pub cache list when there is no cache', () {
45 schedulePub(args: ['cache', 'list'], output: '{"packages":{}}'); 21 schedulePub(args: ['cache', 'list'], output: '{"packages":{}}');
46 }); 22 });
47 23
48 integration('running pub cache list on empty cache', () { 24 integration('running pub cache list on empty cache', () {
49 // Set up a cache. 25 // Set up a cache.
50 d.dir(cachePath, [ 26 d.dir(cachePath, [
51 d.dir('hosted', [ 27 d.dir('hosted', [
52 d.dir('pub.dartlang.org', [ 28 d.dir('pub.dartlang.org', [
53 ]) 29 ])
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 ]) 70 ])
95 ]).create(); 71 ]).create();
96 72
97 schedulePub(args: ['cache', 'list'], outputJson: { 73 schedulePub(args: ['cache', 'list'], outputJson: {
98 "packages": { 74 "packages": {
99 "foo": {"1.2.3": {"location": hostedDir('foo-1.2.3')}} 75 "foo": {"1.2.3": {"location": hostedDir('foo-1.2.3')}}
100 } 76 }
101 }); 77 });
102 }); 78 });
103 } 79 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/lish/package_creation_provides_an_error_test.dart ('k') | sdk/lib/_internal/pub/test/pub_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698