OLD | NEW |
1 library test_pub; | 1 library test_pub; |
2 import 'dart:async'; | 2 import 'dart:async'; |
3 import 'dart:convert'; | 3 import 'dart:convert'; |
4 import 'dart:io'; | 4 import 'dart:io'; |
5 import 'dart:math'; | 5 import 'dart:math'; |
6 import 'package:http/testing.dart'; | 6 import 'package:http/testing.dart'; |
7 import 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
8 import 'package:scheduled_test/scheduled_process.dart'; | 8 import 'package:scheduled_test/scheduled_process.dart'; |
9 import 'package:scheduled_test/scheduled_server.dart'; | 9 import 'package:scheduled_test/scheduled_server.dart'; |
10 import 'package:scheduled_test/scheduled_stream.dart'; | 10 import 'package:scheduled_test/scheduled_stream.dart'; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void scheduleRename(String from, String to) { | 234 void scheduleRename(String from, String to) { |
235 schedule( | 235 schedule( |
236 () => renameDir(p.join(sandboxDir, from), p.join(sandboxDir, to)), | 236 () => renameDir(p.join(sandboxDir, from), p.join(sandboxDir, to)), |
237 'renaming $from to $to'); | 237 'renaming $from to $to'); |
238 } | 238 } |
239 void scheduleSymlink(String target, String symlink) { | 239 void scheduleSymlink(String target, String symlink) { |
240 schedule( | 240 schedule( |
241 () => createSymlink(p.join(sandboxDir, target), p.join(sandboxDir, symlink
)), | 241 () => createSymlink(p.join(sandboxDir, target), p.join(sandboxDir, symlink
)), |
242 'symlinking $target to $symlink'); | 242 'symlinking $target to $symlink'); |
243 } | 243 } |
244 void schedulePub({List args, output, error, outputJson, | 244 void schedulePub({List args, output, error, outputJson, int exitCode: |
245 Future<Uri> tokenEndpoint, int exitCode: exit_codes.SUCCESS}) { | 245 exit_codes.SUCCESS}) { |
246 assert(output == null || outputJson == null); | 246 assert(output == null || outputJson == null); |
247 var pub = startPub(args: args, tokenEndpoint: tokenEndpoint); | 247 var pub = startPub(args: args); |
248 pub.shouldExit(exitCode); | 248 pub.shouldExit(exitCode); |
249 var failures = []; | 249 var failures = []; |
250 var stderr; | 250 var stderr; |
251 expect( | 251 expect( |
252 Future.wait( | 252 Future.wait( |
253 [pub.stdoutStream().toList(), pub.stderrStream().toList()]).then((resu
lts) { | 253 [pub.stdoutStream().toList(), pub.stderrStream().toList()]).then((resu
lts) { |
254 var stdout = results[0].join("\n"); | 254 var stdout = results[0].join("\n"); |
255 stderr = results[1].join("\n"); | 255 stderr = results[1].join("\n"); |
256 if (outputJson == null) { | 256 if (outputJson == null) { |
257 _validateOutput(failures, 'stdout', output, stdout); | 257 _validateOutput(failures, 'stdout', output, stdout); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 bool matches(item, Map matchState) { | 600 bool matches(item, Map matchState) { |
601 if (item is! Pair) return false; | 601 if (item is! Pair) return false; |
602 return _firstMatcher.matches(item.first, matchState) && | 602 return _firstMatcher.matches(item.first, matchState) && |
603 _lastMatcher.matches(item.last, matchState); | 603 _lastMatcher.matches(item.last, matchState); |
604 } | 604 } |
605 Description describe(Description description) { | 605 Description describe(Description description) { |
606 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 606 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
607 } | 607 } |
608 } | 608 } |
609 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); | 609 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); |
OLD | NEW |