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 bd8fc1189f401266b32901be481e73c1115b7cd0..e3033961d6c9e7a7de490ded1936c417716d019c 100644 |
--- a/sdk/lib/_internal/pub/test/test_pub.dart |
+++ b/sdk/lib/_internal/pub/test/test_pub.dart |
@@ -17,6 +17,7 @@ import 'package:http/testing.dart'; |
import 'package:path/path.dart' as path; |
import 'package:scheduled_test/scheduled_process.dart'; |
import 'package:scheduled_test/scheduled_server.dart'; |
+import 'package:scheduled_test/scheduled_stream.dart'; |
import 'package:scheduled_test/scheduled_test.dart'; |
import 'package:unittest/compact_vm_config.dart'; |
import 'package:yaml/yaml.dart'; |
@@ -394,19 +395,20 @@ void schedulePub({List args, Pattern output, Pattern error, outputJson, |
var stderr; |
expect(Future.wait([ |
- pub.remainingStdout(), |
- pub.remainingStderr() |
+ pub.stdoutStream().toList(), |
+ pub.stderrStream().toList() |
]).then((results) { |
- stderr = results[1]; |
+ var stdout = results[0].join("\n"); |
+ stderr = results[1].join("\n"); |
if (outputJson == null) { |
- _validateOutput(failures, 'stdout', output, results[0]); |
+ _validateOutput(failures, 'stdout', output, stdout); |
return null; |
} |
// Allow the expected JSON to contain futures. |
return awaitObject(outputJson).then((resolved) { |
- _validateOutputJson(failures, 'stdout', resolved, results[0]); |
+ _validateOutputJson(failures, 'stdout', resolved, stdout); |
}); |
}).then((_) { |
_validateOutput(failures, 'stderr', error, stderr); |
@@ -434,16 +436,14 @@ ScheduledProcess startPublish(ScheduledServer server, {List args}) { |
void confirmPublish(ScheduledProcess pub) { |
// TODO(rnystrom): This is overly specific and inflexible regarding different |
// test packages. Should validate this a little more loosely. |
- expect(pub.nextLine(), completion(startsWith( |
- 'Publishing test_pkg 1.0.0 to '))); |
- expect(pub.nextLine(), completion(equals("|-- LICENSE"))); |
- expect(pub.nextLine(), completion(equals("|-- lib"))); |
- expect(pub.nextLine(), completion(equals("| '-- test_pkg.dart"))); |
- expect(pub.nextLine(), completion(equals("'-- pubspec.yaml"))); |
- expect(pub.nextLine(), completion(equals(""))); |
- expect(pub.nextLine(), completion(equals('Looks great! Are you ready to ' |
- 'upload your package (y/n)?'))); |
- |
+ pub.stdout.expect(startsWith('Publishing test_pkg 1.0.0 to ')); |
+ pub.stdout.expect(emitsString( |
+ "|-- LICENSE\n" |
+ "|-- lib\n" |
+ "| '-- test_pkg.dart\n" |
+ "'-- pubspec.yaml\n" |
+ "\n" |
+ "Looks great! Are you ready to upload your package (y/n)?")); |
Bob Nystrom
2014/02/14 17:55:02
Multi-line string?
nweiz
2014/02/18 22:01:10
Same response as before -- why here and not elsewh
Bob Nystrom
2014/02/18 22:12:59
Same response as before. It's already six lines of
|
pub.writeLine("y"); |
} |
@@ -866,3 +866,6 @@ class _PairMatcher extends Matcher { |
description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
} |
} |
+ |
+/// A [StreamMatcher] that matches multiple lines of output. |
+StreamMatcher emitsString(String output) => inOrder(output.split("\n")); |
Bob Nystrom
2014/02/14 17:55:02
How about "emitsLines"?
nweiz
2014/02/18 22:01:10
I considered that name, but it felt weird that it
Bob Nystrom
2014/02/18 22:12:59
Yeah, I think it does. Before I saw the doc commen
nweiz
2014/02/18 22:28:02
Done.
|