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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/run/mode_test.dart

Issue 896623005: Use native async/await support in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes 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 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 '../descriptor.dart' as d;
6 import '../test_pub.dart';
7
8 const TRANSFORMER = """
9 import 'dart:async';
10
11 import 'package:barback/barback.dart';
12
13 class DartTransformer extends Transformer {
14 final BarbackSettings _settings;
15
16 DartTransformer.asPlugin(this._settings);
17
18 String get allowedExtensions => '.in';
19
20 void apply(Transform transform) {
21 transform.addOutput(new Asset.fromString(
22 new AssetId(transform.primaryInput.id.package, "bin/script.dart"),
23 "void main() => print('\${_settings.mode.name}');"));
24 }
25 }
26 """;
27
28 main() {
29 initConfig();
30 withBarbackVersions("any", () {
31 integration('runs a local script with customizable modes', () {
32 d.dir(appPath, [d.pubspec({
33 "name": "myapp",
34 "transformers": ["myapp/src/transformer"]
35 }),
36 d.dir(
37 "lib",
38 [
39 d.dir(
40 "src",
41 [
42 d.file("transformer.dart", TRANSFORMER),
43 d.file("primary.in", "")])])]).create();
44
45 createLockFile('myapp', pkg: ['barback']);
46
47 // By default it should run in debug mode.
48 var pub = pubRun(args: ["script"]);
49 pub.stdout.expect("debug");
50 pub.shouldExit();
51
52 // A custom mode should be specifiable.
53 pub = pubRun(args: ["--mode", "custom-mode", "script"]);
54 pub.stdout.expect("custom-mode");
55 pub.shouldExit();
56 });
57
58 integration('runs a dependency script with customizable modes', () {
59 d.dir("foo", [d.pubspec({
60 "name": "foo",
61 "version": "1.2.3",
62 "transformers": ["foo/src/transformer"]
63 }),
64 d.dir(
65 "lib",
66 [
67 d.dir(
68 "src",
69 [
70 d.file("transformer.dart", TRANSFORMER),
71 d.file("primary.in", "")])])]).create();
72
73 d.appDir({
74 "foo": {
75 "path": "../foo"
76 }
77 }).create();
78
79 createLockFile('myapp', sandbox: ['foo'], pkg: ['barback']);
80
81 // By default it should run in release mode.
82 var pub = pubRun(args: ["foo:script"]);
83 pub.stdout.expect("release");
84 pub.shouldExit();
85
86 // A custom mode should be specifiable.
87 pub = pubRun(args: ["--mode", "custom-mode", "foo:script"]);
88 pub.stdout.expect("custom-mode");
89 pub.shouldExit();
90 });
91 });
92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698