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

Unified Diff: utils/tests/pub/pub_test.dart

Issue 10214006: Refactor command code and add support for --help and --version. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/pub.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/pub_test.dart
diff --git a/utils/tests/pub/pub_test.dart b/utils/tests/pub/pub_test.dart
index 55c93c45191cc7fe2b7b89f9def8bd30e1a6f211..b84a0dc7fa6aac9e29cbd7a747168abab1f7afae 100644
--- a/utils/tests/pub/pub_test.dart
+++ b/utils/tests/pub/pub_test.dart
@@ -9,26 +9,42 @@
#import('test_pub.dart');
#import('../../../lib/unittest/unittest.dart');
-main() {
- group('running pub with no command', () {
- testPub('displays usage',
- args: [],
- output: """
- Pub is a package manager for Dart.
+final USAGE_STRING = """
+ Pub is a package manager for Dart.
- Usage:
+ Usage:
- pub command [arguments]
+ pub command [arguments]
- The commands are:
+ The commands are:
- list print the contents of repositories
- update update a package's dependencies
- version print Pub version
+ list print the contents of repositories
+ update update the current package's dependencies to the latest versions
+ version print Pub version
- Use "pub help [command]" for more information about a command.
- """);
- });
+ Use "pub help [command]" for more information about a command.
+ """;
+
+final VERSION_STRING = '''
+ Pub 0.0.0
+ ''';
+
+main() {
+ testPub('running pub with no command displays usage',
+ args: [],
+ output: USAGE_STRING);
+
+ testPub('running pub with just --help displays usage',
+ args: ['--help'],
+ output: USAGE_STRING);
+
+ testPub('running pub with just -h displays usage',
+ args: ['-h'],
+ output: USAGE_STRING);
+
+ testPub('running pub with just --version displays version',
+ args: ['--version'],
+ output: VERSION_STRING);
group('an unknown command', () {
testPub('displays an error message',
@@ -108,7 +124,5 @@ updateCommand() {
versionCommand() {
testPub('displays the current version',
args: ['version'],
- output: '''
- Pub 0.0.0
- ''');
+ output: VERSION_STRING);
}
« no previous file with comments | « utils/pub/pub.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698