| OLD | NEW |
| (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 SCRIPT = """ | |
| 9 main() { | |
| 10 print("should not get here!"); | |
| 11 } | |
| 12 """; | |
| 13 | |
| 14 const TRANSFORMER = """ | |
| 15 import 'dart:async'; | |
| 16 | |
| 17 import 'package:barback/barback.dart'; | |
| 18 | |
| 19 class FailingTransformer extends Transformer { | |
| 20 FailingTransformer.asPlugin(); | |
| 21 | |
| 22 String get allowedExtensions => '.dart'; | |
| 23 | |
| 24 void apply(Transform transform) { | |
| 25 // Don't run on the transformer itself. | |
| 26 if (transform.primaryInput.id.path.startsWith("lib")) return; | |
| 27 transform.logger.error('\${transform.primaryInput.id}.'); | |
| 28 } | |
| 29 } | |
| 30 """; | |
| 31 | |
| 32 main() { | |
| 33 initConfig(); | |
| 34 withBarbackVersions("any", () { | |
| 35 integration('does not run if a transformer has an error', () { | |
| 36 d.dir(appPath, [d.pubspec({ | |
| 37 "name": "myapp", | |
| 38 "transformers": ["myapp/src/transformer"] | |
| 39 }), | |
| 40 d.dir("lib", [d.dir("src", [d.file("transformer.dart", TRANSFORMER)]
)]), | |
| 41 d.dir("bin", [d.file("script.dart", SCRIPT)])]).create(); | |
| 42 | |
| 43 createLockFile('myapp', pkg: ['barback']); | |
| 44 | |
| 45 var pub = pubRun(args: ["script"]); | |
| 46 | |
| 47 pub.stderr.expect("[Error from Failing]:"); | |
| 48 pub.stderr.expect("myapp|bin/script.dart."); | |
| 49 | |
| 50 // Note: no output from the script. | |
| 51 pub.shouldExit(); | |
| 52 }); | |
| 53 }); | |
| 54 } | |
| OLD | NEW |