OLD | NEW |
(Empty) | |
| 1 import 'package:scheduled_test/scheduled_test.dart'; |
| 2 import '../../lib/src/exit_codes.dart' as exit_codes; |
| 3 import '../test_pub.dart'; |
| 4 void pubBuildAndServeShouldFail(String description, {List<String> args, |
| 5 String error, String buildError, String serveError, int exitCode}) { |
| 6 if (error != null) { |
| 7 assert(buildError == null); |
| 8 buildError = error; |
| 9 assert(serveError == null); |
| 10 serveError = error; |
| 11 } |
| 12 var buildExpectation = buildError; |
| 13 var serveExpectation = serveError; |
| 14 if (exitCode == exit_codes.USAGE) { |
| 15 buildExpectation = |
| 16 allOf(startsWith(buildExpectation), contains("Usage: pub build")); |
| 17 serveExpectation = |
| 18 allOf(startsWith(serveExpectation), contains("Usage: pub serve")); |
| 19 } |
| 20 integration("build fails $description", () { |
| 21 schedulePub( |
| 22 args: ["build"]..addAll(args), |
| 23 error: buildExpectation, |
| 24 exitCode: exitCode); |
| 25 }); |
| 26 integration("build --format json fails $description", () { |
| 27 schedulePub(args: ["build", "--format", "json"]..addAll(args), outputJson: { |
| 28 "error": buildError |
| 29 }, exitCode: exitCode); |
| 30 }); |
| 31 integration("serve fails $description", () { |
| 32 schedulePub( |
| 33 args: ["serve"]..addAll(args), |
| 34 error: serveExpectation, |
| 35 exitCode: exitCode); |
| 36 }); |
| 37 } |
OLD | NEW |