OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:scheduled_test/scheduled_test.dart'; | 5 import 'package:scheduled_test/scheduled_test.dart'; |
6 | 6 |
7 import '../../lib/src/exit_codes.dart' as exit_codes; | 7 import '../../lib/src/exit_codes.dart' as exit_codes; |
8 import '../test_pub.dart'; | 8 import '../test_pub.dart'; |
9 | 9 |
10 /// Runs separate integration tests for "pub build", "pub serve", and | 10 /// Runs separate integration tests for "pub build", "pub serve", and |
(...skipping 14 matching lines...) Expand all Loading... |
25 buildError = error; | 25 buildError = error; |
26 | 26 |
27 assert(serveError == null); | 27 assert(serveError == null); |
28 serveError = error; | 28 serveError = error; |
29 } | 29 } |
30 | 30 |
31 // Usage errors also print the usage, so validate that. | 31 // Usage errors also print the usage, so validate that. |
32 var buildExpectation = buildError; | 32 var buildExpectation = buildError; |
33 var serveExpectation = serveError; | 33 var serveExpectation = serveError; |
34 if (exitCode == exit_codes.USAGE) { | 34 if (exitCode == exit_codes.USAGE) { |
35 buildExpectation = allOf( | 35 buildExpectation = |
36 startsWith(buildExpectation), contains("Usage: pub build")); | 36 allOf(startsWith(buildExpectation), contains("Usage: pub build")); |
37 serveExpectation = allOf( | 37 serveExpectation = |
38 startsWith(serveExpectation), contains("Usage: pub serve")); | 38 allOf(startsWith(serveExpectation), contains("Usage: pub serve")); |
39 } | 39 } |
40 | 40 |
41 integration("build fails $description", () { | 41 integration("build fails $description", () { |
42 schedulePub(args: ["build"]..addAll(args), | 42 schedulePub( |
| 43 args: ["build"]..addAll(args), |
43 error: buildExpectation, | 44 error: buildExpectation, |
44 exitCode: exitCode); | 45 exitCode: exitCode); |
45 }); | 46 }); |
46 | 47 |
47 integration("build --format json fails $description", () { | 48 integration("build --format json fails $description", () { |
48 schedulePub(args: ["build", "--format", "json"]..addAll(args), | 49 schedulePub(args: ["build", "--format", "json"]..addAll(args), outputJson: { |
49 outputJson: { | 50 "error": buildError // No usage in JSON output. |
50 "error": buildError // No usage in JSON output. | 51 }, exitCode: exitCode); |
51 }, | |
52 exitCode: exitCode); | |
53 }); | 52 }); |
54 | 53 |
55 integration("serve fails $description", () { | 54 integration("serve fails $description", () { |
56 schedulePub(args: ["serve"]..addAll(args), | 55 schedulePub( |
| 56 args: ["serve"]..addAll(args), |
57 error: serveExpectation, | 57 error: serveExpectation, |
58 exitCode: exitCode); | 58 exitCode: exitCode); |
59 }); | 59 }); |
60 } | 60 } |
OLD | NEW |