OLD | NEW |
(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 integration( |
| 25 'runs a script in an activated package with customizable modes', |
| 26 () { |
| 27 servePackages((builder) { |
| 28 builder.serveRepoPackage("barback"); |
| 29 builder.serve("foo", "1.0.0", deps: { |
| 30 "barback": "any" |
| 31 }, pubspec: { |
| 32 "transformers": ["foo/src/transformer"] |
| 33 }, |
| 34 contents: [ |
| 35 d.dir( |
| 36 "lib", |
| 37 [ |
| 38 d.dir( |
| 39 "src", |
| 40 [d.file("transformer.dart", TRANSFORMER), d.file("prim
ary.in", "")])])]); |
| 41 }); |
| 42 schedulePub(args: ["global", "activate", "foo"]); |
| 43 var pub = pubRun(global: true, args: ["foo:script"]); |
| 44 pub.stdout.expect("release"); |
| 45 pub.shouldExit(); |
| 46 pub = pubRun(global: true, args: ["--mode", "custom-mode", "foo:script"]); |
| 47 pub.stdout.expect("custom-mode"); |
| 48 pub.shouldExit(); |
| 49 }); |
| 50 } |
OLD | NEW |