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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/barback/utils.dart

Issue 937243002: Revert "Revert "Use native async/await support in pub."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:scheduled_test/scheduled_test.dart';
6
7 import '../../lib/src/exit_codes.dart' as exit_codes;
8 import '../test_pub.dart';
9
10 /// Runs separate integration tests for "pub build", "pub serve", and
11 /// "pub build --format json" and validates that in all cases, it fails with
12 /// an expected error message and exits with [exitCode].
13 ///
14 /// The integrations assume set up is already done, so you will likely want to
15 /// call [setUp] before this.
16 ///
17 /// If [error] is provided, then both pub build and pub serve should exit with
18 /// that message. Otherwise, [buildError] is the expected error from pub build
19 /// and [serveError] from pub serve.
20 void pubBuildAndServeShouldFail(String description, {List<String> args,
21 String error, String buildError, String serveError, int exitCode}) {
22
23 if (error != null) {
24 assert(buildError == null);
25 buildError = error;
26
27 assert(serveError == null);
28 serveError = error;
29 }
30
31 // Usage errors also print the usage, so validate that.
32 var buildExpectation = buildError;
33 var serveExpectation = serveError;
34 if (exitCode == exit_codes.USAGE) {
35 buildExpectation =
36 allOf(startsWith(buildExpectation), contains("Usage: pub build"));
37 serveExpectation =
38 allOf(startsWith(serveExpectation), contains("Usage: pub serve"));
39 }
40
41 integration("build fails $description", () {
42 schedulePub(
43 args: ["build"]..addAll(args),
44 error: buildExpectation,
45 exitCode: exitCode);
46 });
47
48 integration("build --format json fails $description", () {
49 schedulePub(args: ["build", "--format", "json"]..addAll(args), outputJson: {
50 "error": buildError // No usage in JSON output.
51 }, exitCode: exitCode);
52 });
53
54 integration("serve fails $description", () {
55 schedulePub(
56 args: ["serve"]..addAll(args),
57 error: serveExpectation,
58 exitCode: exitCode);
59 });
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698