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

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

Issue 15444003: Use args' command support for pub commands. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Initialize command args in constructor. Created 7 years, 7 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 | « sdk/lib/_internal/pub/test/pub_cache_test.dart ('k') | 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) 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 'package:scheduled_test/scheduled_test.dart'; 9 import 'package:scheduled_test/scheduled_test.dart';
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 }); 54 });
55 55
56 integration('running pub with just --help displays usage', () { 56 integration('running pub with just --help displays usage', () {
57 schedulePub(args: ['--help'], output: USAGE_STRING); 57 schedulePub(args: ['--help'], output: USAGE_STRING);
58 }); 58 });
59 59
60 integration('running pub with just -h displays usage', () { 60 integration('running pub with just -h displays usage', () {
61 schedulePub(args: ['-h'], output: USAGE_STRING); 61 schedulePub(args: ['-h'], output: USAGE_STRING);
62 }); 62 });
63 63
64 integration('running pub with --help after command shows command usage', () {
65 schedulePub(args: ['install', '--help'],
66 output: '''
67 Install the current package's dependencies.
68
69 Usage: pub install
70 -h, --help Print usage information for this command.
71 --[no-]offline Use cached packages instead of accessing the net work.
72 ''');
73 });
74
75 integration('running pub with -h after command shows command usage', () {
76 schedulePub(args: ['install', '-h'],
77 output: '''
78 Install the current package's dependencies.
79
80 Usage: pub install
81 -h, --help Print usage information for this command.
82 --[no-]offline Use cached packages instead of accessing the net work.
83 ''');
84 });
85
64 integration('running pub with just --version displays version', () { 86 integration('running pub with just --version displays version', () {
65 schedulePub(args: ['--version'], output: VERSION_STRING); 87 schedulePub(args: ['--version'], output: VERSION_STRING);
66 }); 88 });
67 89
68 integration('an unknown command displays an error message', () { 90 integration('an unknown command displays an error message', () {
69 schedulePub(args: ['quylthulg'], 91 schedulePub(args: ['quylthulg'],
70 error: ''' 92 error: '''
71 Could not find a command named "quylthulg". 93 Could not find a command named "quylthulg".
72 Run "pub help" to see available commands. 94 Run "pub help" to see available commands.
73 ''', 95 ''',
74 exitCode: 64); 96 exitCode: 64);
75 }); 97 });
76 98
77 integration('an unknown option displays an error message', () { 99 integration('an unknown option displays an error message', () {
78 schedulePub(args: ['--blorf'], 100 schedulePub(args: ['--blorf'],
79 error: ''' 101 error: '''
80 Could not find an option named "blorf". 102 Could not find an option named "blorf".
81 Run "pub help" to see available options. 103 Run "pub help" to see available options.
82 ''', 104 ''',
83 exitCode: 64); 105 exitCode: 64);
84 }); 106 });
85 107
86 integration('an unknown command option displays an error message', () { 108 integration('an unknown command option displays an error message', () {
87 // TODO(rnystrom): When pub has command-specific options, a more precise 109 // TODO(rnystrom): When pub has command-specific options, a more precise
88 // error message would be good here. 110 // error message would be good here.
89 schedulePub(args: ['version', '--blorf'], 111 schedulePub(args: ['version', '--blorf'],
90 error: ''' 112 error: '''
91 Could not find an option named "blorf". 113 Could not find an option named "blorf".
92 Use "pub help" for more information. 114 Run "pub help" to see available options.
93 ''', 115 ''',
94 exitCode: 64); 116 exitCode: 64);
95 }); 117 });
96 118
97 group('help', () { 119 group('help', () {
98 integration('shows help for a command', () { 120 integration('shows help for a command', () {
99 schedulePub(args: ['help', 'install'], 121 schedulePub(args: ['help', 'install'],
100 output: ''' 122 output: '''
101 Install the current package's dependencies. 123 Install the current package's dependencies.
102 124
103 Usage: pub install 125 Usage: pub install
104 --[no-]offline Use cached packages instead of accessing the netwo rk. 126 -h, --help Print usage information for this command.
127 --[no-]offline Use cached packages instead of accessing the n etwork.
105 '''); 128 ''');
106 }); 129 });
107 130
108 integration('shows help for a command', () { 131 integration('shows help for a command', () {
109 schedulePub(args: ['help', 'publish'], 132 schedulePub(args: ['help', 'publish'],
110 output: ''' 133 output: '''
111 Publish the current package to pub.dartlang.org. 134 Publish the current package to pub.dartlang.org.
112 135
113 Usage: pub publish [options] 136 Usage: pub publish [options]
137 -h, --help Print usage information for this command.
114 -n, --dry-run Validate but do not publish the package. 138 -n, --dry-run Validate but do not publish the package.
115 -f, --force Publish without confirmation if there are no errors . 139 -f, --force Publish without confirmation if there are no errors .
116 --server The package server to which to upload this package. 140 --server The package server to which to upload this package.
117 (defaults to "https://pub.dartlang.org") 141 (defaults to "https://pub.dartlang.org")
118 '''); 142 ''');
119 }); 143 });
120 144
121 integration('an unknown help command displays an error message', () { 145 integration('an unknown help command displays an error message', () {
122 schedulePub(args: ['help', 'quylthulg'], 146 schedulePub(args: ['help', 'quylthulg'],
123 error: ''' 147 error: '''
(...skipping 22 matching lines...) Expand all
146 // The "version" file generated on developer builds is a little funky and 170 // The "version" file generated on developer builds is a little funky and
147 // we need to make sure we don't choke on it. 171 // we need to make sure we don't choke on it.
148 d.dir(sdkPath, [ 172 d.dir(sdkPath, [
149 d.file('version', '0.1.2.0_r16279_bobross'), 173 d.file('version', '0.1.2.0_r16279_bobross'),
150 ]).create(); 174 ]).create();
151 175
152 schedulePub(args: ['version'], output: "Pub 0.1.2+0.r16279.bobross\n"); 176 schedulePub(args: ['version'], output: "Pub 0.1.2+0.r16279.bobross\n");
153 }); 177 });
154 }); 178 });
155 } 179 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/pub_cache_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698