UsageException isn't called UsageError.
Closes #50.
R=rnystrom@google.com
Review URL: https://codereview.chromium.org//1985883002 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1c9f5fc..cbbe463 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.13.4+2
+
+* Fix a minor documentation error.
+
## 0.13.4+1
* Ensure that multiple-value arguments produce reified `List<String>`s.
diff --git a/lib/command_runner.dart b/lib/command_runner.dart
index d0cbf26..1e33965 100644
--- a/lib/command_runner.dart
+++ b/lib/command_runner.dart
@@ -98,7 +98,7 @@
/// Parses [args] and invokes [Command.run] on the chosen command.
///
/// This always returns a [Future] in case the command is asynchronous. The
- /// [Future] will throw a [UsageError] if [args] was invalid.
+ /// [Future] will throw a [UsageException] if [args] was invalid.
Future run(Iterable<String> args) =>
new Future.sync(() => runCommand(parse(args)));
diff --git a/pubspec.yaml b/pubspec.yaml
index 78a8a72..4f5fb7f 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: args
-version: 0.13.4+1
+version: 0.13.4+2
author: "Dart Team <misc@dartlang.org>"
homepage: https://github.com/dart-lang/args
description: >
diff --git a/test/command_runner_test.dart b/test/command_runner_test.dart
index 9961e7d..d6605a4 100644
--- a/test/command_runner_test.dart
+++ b/test/command_runner_test.dart
@@ -139,7 +139,7 @@
test("usageException splits up the message and usage", () {
expect(() => runner.usageException("message"),
- throwsUsageError("message", _DEFAULT_USAGE));
+ throwsUsageException("message", _DEFAULT_USAGE));
});
group("run()", () {
@@ -262,7 +262,7 @@
});
test("includes the footer in usage errors", () {
- expect(runner.run(["--bad"]), throwsUsageError(
+ expect(runner.run(["--bad"]), throwsUsageException(
'Could not find an option named "bad".',
"$_DEFAULT_USAGE\nAlso, footer!"));
});
@@ -270,19 +270,19 @@
group("throws a useful error when", () {
test("arg parsing fails", () {
- expect(runner.run(["--bad"]), throwsUsageError(
+ expect(runner.run(["--bad"]), throwsUsageException(
'Could not find an option named "bad".', _DEFAULT_USAGE));
});
test("a top-level command doesn't exist", () {
- expect(runner.run(["bad"]), throwsUsageError(
+ expect(runner.run(["bad"]), throwsUsageException(
'Could not find a command named "bad".', _DEFAULT_USAGE));
});
test("a subcommand doesn't exist", () {
runner.addCommand(new FooCommand()..addSubcommand(new AsyncCommand()));
- expect(runner.run(["foo bad"]), throwsUsageError(
+ expect(runner.run(["foo bad"]), throwsUsageException(
'Could not find a command named "foo bad".', """
Usage: test <command> [arguments]
@@ -299,7 +299,7 @@
test("a subcommand wasn't passed", () {
runner.addCommand(new FooCommand()..addSubcommand(new AsyncCommand()));
- expect(runner.run(["foo"]), throwsUsageError(
+ expect(runner.run(["foo"]), throwsUsageException(
'Missing subcommand for "test foo".', """
Usage: test foo <subcommand> [arguments]
-h, --help Print this usage information.
@@ -313,7 +313,7 @@
test("a command that doesn't take arguments was given them", () {
runner.addCommand(new FooCommand());
- expect(runner.run(["foo", "bar"]), throwsUsageError(
+ expect(runner.run(["foo", "bar"]), throwsUsageException(
'Command "foo" does not take any arguments.', """
Usage: test foo [arguments]
-h, --help Print this usage information.
diff --git a/test/command_test.dart b/test/command_test.dart
index 127cfc9..cd32c63 100644
--- a/test/command_test.dart
+++ b/test/command_test.dart
@@ -90,7 +90,8 @@
});
test("usageException splits up the message and usage", () {
- expect(() => foo.usageException("message"), throwsUsageError("message", """
+ expect(() => foo.usageException("message"),
+ throwsUsageException("message", """
Usage: test foo [arguments]
-h, --help Print this usage information.
diff --git a/test/utils.dart b/test/utils.dart
index 1fd8468..e07f8f3 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -87,7 +87,7 @@
expect(() => parser.parse(args), throwsFormatException);
}
-Matcher throwsUsageError(message, usage) {
+Matcher throwsUsageException(message, usage) {
return throwsA(predicate((error) {
expect(error, new isInstanceOf<UsageException>());
expect(error.message, message);