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

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

Issue 11363249: Fix error reporting on invalid command line args. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/version_solver.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 a1e1bc7a68973fd4c1273c5e632ffc4cd8419300..bc18d9d6332bdb29475961640dd98553b99c66b3 100644
--- a/utils/tests/pub/pub_test.dart
+++ b/utils/tests/pub/pub_test.dart
@@ -19,7 +19,7 @@ final USAGE_STRING = """
--version Prints the version of Pub
--[no-]trace Prints a stack trace when an error occurs
- The commands are:
+ Available commands:
help display help information for Pub
install install the current package's dependencies
update update the current package's dependencies to the latest versions
@@ -45,15 +45,42 @@ main() {
test('running pub with just --version displays version', () =>
runPub(args: ['--version'], output: VERSION_STRING));
- group('an unknown command', () {
- test('displays an error message', () {
- runPub(args: ['quylthulg'],
- error: '''
- Unknown command "quylthulg".
- Run "pub help" to see available commands.
- ''',
- exitCode: 64);
- });
+ test('an unknown command displays an error message', () {
+ runPub(args: ['quylthulg'],
+ error: '''
+ Could not find a command named "quylthulg".
+ Run "pub help" to see available commands.
+ ''',
+ exitCode: 64);
+ });
+
+ test('an unknown option displays an error message', () {
+ runPub(args: ['--blorf'],
+ error: '''
+ Could not find an option named "blorf".
+ Run "pub help" to see available options.
+ ''',
+ exitCode: 64);
+ });
+
+ test('an unknown command option displays an error message', () {
+ // TODO(rnystrom): When pub has command-specific options, a more precise
+ // error message would be good here.
+ runPub(args: ['version', '--blorf'],
+ error: '''
+ Could not find an option named "blorf".
+ Use "pub help" for more information.
+ ''',
+ exitCode: 64);
+ });
+
+ test('an unknown help command displays an error message', () {
+ runPub(args: ['help', 'quylthulg'],
+ error: '''
+ Could not find a command named "quylthulg".
+ Run "pub help" to see available commands.
+ ''',
+ exitCode: 64);
});
test('displays the current version', () =>
« no previous file with comments | « utils/pub/version_solver.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698