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

Unified Diff: sdk/lib/_internal/pub/test/test_pub.dart

Issue 351703004: Improve pub's pubspec error messages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 6 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
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 9342f6a54875dad7f38482e3875c62306fc00264..1f7d94ca492a4e34aa67915e3aef4a6cbaf2dc96 100644
--- a/sdk/lib/_internal/pub/test/test_pub.dart
+++ b/sdk/lib/_internal/pub/test/test_pub.dart
@@ -344,9 +344,11 @@ void forBothPubGetAndUpgrade(void callback(RunCommand command)) {
/// [warning] to stderr. If [error] is given, it expects the command to *only*
/// print [error] to stderr. [output], [error], and [warning] may be strings,
/// [RegExp]s, or [Matcher]s.
+///
+/// If [exitCode] is given, expects the command to exit with that code.
// TODO(rnystrom): Clean up other tests to call this when possible.
void pubCommand(RunCommand command,
- {Iterable<String> args, output, error, warning}) {
+ {Iterable<String> args, output, error, warning, int exitCode}) {
if (error != null && warning != null) {
throw new ArgumentError("Cannot pass both 'error' and 'warning'.");
}
@@ -356,8 +358,7 @@ void pubCommand(RunCommand command,
if (output == null) output = command.success;
- var exitCode = null;
- if (error != null) exitCode = 1;
+ if (error != null && exitCode == null) exitCode = 1;
// No success output on an error.
if (error != null) output = null;
@@ -366,14 +367,14 @@ void pubCommand(RunCommand command,
schedulePub(args: allArgs, output: output, error: error, exitCode: exitCode);
}
-void pubGet({Iterable<String> args, output, error, warning}) {
+void pubGet({Iterable<String> args, output, error, warning, int exitCode}) {
pubCommand(RunCommand.get, args: args, output: output, error: error,
- warning: warning);
+ warning: warning, exitCode: exitCode);
}
-void pubUpgrade({Iterable<String> args, output, error, warning}) {
+void pubUpgrade({Iterable<String> args, output, error, warning, int exitCode}) {
pubCommand(RunCommand.upgrade, args: args, output: output, error: error,
- warning: warning);
+ warning: warning, exitCode: exitCode);
}
/// Defines an integration test.

Powered by Google App Engine
This is Rietveld 408576698