Chromium Code Reviews| Index: sdk/lib/_internal/pub/test/test_pub.dart |
| diff --git a/sdk/lib/_internal/pub/test/test_pub.dart b/sdk/lib/_internal/pub/test/test_pub.dart |
| index 6eef80b912570f8599f62de7092353acab39f9bf..dbb63d045190fd19b74b6e49eb39729e58c1db77 100644 |
| --- a/sdk/lib/_internal/pub/test/test_pub.dart |
| +++ b/sdk/lib/_internal/pub/test/test_pub.dart |
| @@ -263,13 +263,14 @@ bool _abortScheduled = false; |
| /// Enum identifying a pub command that can be run with a well-defined success |
| /// output. |
| class RunCommand { |
| - static final get = new RunCommand('get', 'Got dependencies!'); |
| - static final upgrade = new RunCommand('upgrade', 'Dependencies upgraded!'); |
| + static final get = new RunCommand('get', r'Got dependencies!$'); |
| + static final upgrade = new RunCommand('upgrade', |
| + r'(No dependencies changed\.|Changed \d+ dependenc(y|ies)!)$'); |
| final String name; |
| final RegExp success; |
| - RunCommand(this.name, String message) |
| - : success = new RegExp("$message\$"); |
| + RunCommand(this.name, String pattern) |
|
nweiz
2013/12/11 06:48:32
If you're going to take a pattern, take a Pattern.
Bob Nystrom
2013/12/11 22:36:59
Done.
|
| + : success = new RegExp(pattern); |
| } |
| /// Many tests validate behavior that is the same between pub get and |
| @@ -290,8 +291,8 @@ void forBothPubGetAndUpgrade(void callback(RunCommand command)) { |
| /// [warning] to stderr. If [error] is given, it expects the command to *only* |
| /// print [error] to stderr. |
| // TODO(rnystrom): Clean up other tests to call this when possible. |
| -void pubCommand(RunCommand command, {Iterable<String> args, Pattern error, |
| - Pattern warning}) { |
| +void pubCommand(RunCommand command, |
| + {Iterable<String> args, Pattern output, Pattern error, Pattern warning}) { |
| if (error != null && warning != null) { |
| throw new ArgumentError("Cannot pass both 'error' and 'warning'."); |
| } |
| @@ -299,7 +300,7 @@ void pubCommand(RunCommand command, {Iterable<String> args, Pattern error, |
| var allArgs = [command.name]; |
| if (args != null) allArgs.addAll(args); |
| - var output = command.success; |
| + if (output == null) output = command.success; |
| var exitCode = null; |
| if (error != null) exitCode = 1; |
| @@ -316,9 +317,10 @@ void pubGet({Iterable<String> args, Pattern error, |
| pubCommand(RunCommand.get, args: args, error: error, warning: warning); |
| } |
| -void pubUpgrade({Iterable<String> args, Pattern error, |
| +void pubUpgrade({Iterable<String> args, Pattern output, Pattern error, |
| Pattern warning}) { |
| - pubCommand(RunCommand.upgrade, args: args, error: error, warning: warning); |
| + pubCommand(RunCommand.upgrade, args: args, output: output, error: error, |
| + warning: warning); |
| } |
| /// Defines an integration test. The [body] should schedule a series of |