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

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

Issue 550643003: Add a --mode flag to pub run and pub global run. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 3 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
« no previous file with comments | « sdk/lib/_internal/pub_generated/test/global/run/mode_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import '../descriptor.dart' as d;
2 import '../test_pub.dart';
3 const TRANSFORMER = """
4 import 'dart:async';
5
6 import 'package:barback/barback.dart';
7
8 class DartTransformer extends Transformer {
9 final BarbackSettings _settings;
10
11 DartTransformer.asPlugin(this._settings);
12
13 String get allowedExtensions => '.in';
14
15 void apply(Transform transform) {
16 transform.addOutput(new Asset.fromString(
17 new AssetId(transform.primaryInput.id.package, "bin/script.dart"),
18 "void main() => print('\${_settings.mode.name}');"));
19 }
20 }
21 """;
22 main() {
23 initConfig();
24 withBarbackVersions("any", () {
25 integration('runs a local script with customizable modes', () {
26 d.dir(appPath, [d.pubspec({
27 "name": "myapp",
28 "transformers": ["myapp/src/transformer"]
29 }),
30 d.dir(
31 "lib",
32 [
33 d.dir(
34 "src",
35 [
36 d.file("transformer.dart", TRANSFORMER),
37 d.file("primary.in", "")])])]).create();
38 createLockFile('myapp', pkg: ['barback']);
39 var pub = pubRun(args: ["script"]);
40 pub.stdout.expect("debug");
41 pub.shouldExit();
42 pub = pubRun(args: ["--mode", "custom-mode", "script"]);
43 pub.stdout.expect("custom-mode");
44 pub.shouldExit();
45 });
46 integration('runs a dependency script with customizable modes', () {
47 d.dir("foo", [d.pubspec({
48 "name": "foo",
49 "version": "1.2.3",
50 "transformers": ["foo/src/transformer"]
51 }),
52 d.dir(
53 "lib",
54 [
55 d.dir(
56 "src",
57 [
58 d.file("transformer.dart", TRANSFORMER),
59 d.file("primary.in", "")])])]).create();
60 d.appDir({
61 "foo": {
62 "path": "../foo"
63 }
64 }).create();
65 createLockFile('myapp', sandbox: ['foo'], pkg: ['barback']);
66 var pub = pubRun(args: ["foo:script"]);
67 pub.stdout.expect("release");
68 pub.shouldExit();
69 pub = pubRun(args: ["--mode", "custom-mode", "foo:script"]);
70 pub.stdout.expect("custom-mode");
71 pub.shouldExit();
72 });
73 });
74 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub_generated/test/global/run/mode_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698