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

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

Issue 1165473002: Start pulling pub from its own repo. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Code review changes Created 5 years, 6 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
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, [
33 d.pubspec({
34 "name": "myapp",
35 "transformers": ["myapp/src/transformer"]
36 }),
37 d.dir("lib", [d.dir("src", [
38 d.file("transformer.dart", TRANSFORMER),
39 d.file("primary.in", "")
40 ])])
41 ]).create();
42
43 createLockFile('myapp', pkg: ['barback']);
44
45 // By default it should run in debug mode.
46 var pub = pubRun(args: ["bin/script"]);
47 pub.stdout.expect("debug");
48 pub.shouldExit();
49
50 // A custom mode should be specifiable.
51 pub = pubRun(args: ["--mode", "custom-mode", "bin/script"]);
52 pub.stdout.expect("custom-mode");
53 pub.shouldExit();
54 });
55
56 integration('runs a dependency script with customizable modes', () {
57 d.dir("foo", [
58 d.pubspec({
59 "name": "foo",
60 "version": "1.2.3",
61 "transformers": ["foo/src/transformer"]
62 }),
63 d.dir("lib", [d.dir("src", [
64 d.file("transformer.dart", TRANSFORMER),
65 d.file("primary.in", "")
66 ])])
67 ]).create();
68
69 d.appDir({"foo": {"path": "../foo"}}).create();
70
71 createLockFile('myapp', sandbox: ['foo'], pkg: ['barback']);
72
73 // By default it should run in release mode.
74 var pub = pubRun(args: ["foo:script"]);
75 pub.stdout.expect("release");
76 pub.shouldExit();
77
78 // A custom mode should be specifiable.
79 pub = pubRun(args: ["--mode", "custom-mode", "foo:script"]);
80 pub.stdout.expect("custom-mode");
81 pub.shouldExit();
82 });
83 });
84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698