| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.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 library pub_tests; | |
| 6 | |
| 7 import 'package:scheduled_test/scheduled_stream.dart'; | |
| 8 import 'package:scheduled_test/scheduled_test.dart'; | |
| 9 | |
| 10 import '../descriptor.dart' as d; | |
| 11 import '../test_pub.dart'; | |
| 12 import '../serve/utils.dart'; | |
| 13 | |
| 14 const REJECT_CONFIG_TRANSFORMER = """ | |
| 15 import 'dart:async'; | |
| 16 | |
| 17 import 'package:barback/barback.dart'; | |
| 18 | |
| 19 class RejectConfigTransformer extends Transformer { | |
| 20 RejectConfigTransformer.asPlugin(BarbackSettings settings) { | |
| 21 throw "I hate these settings!"; | |
| 22 } | |
| 23 | |
| 24 Future<bool> isPrimary(_) => new Future.value(true); | |
| 25 Future apply(Transform transform) {} | |
| 26 } | |
| 27 """; | |
| 28 | |
| 29 main() { | |
| 30 initConfig(); | |
| 31 | |
| 32 withBarbackVersions("any", () { | |
| 33 integration( | |
| 34 "multiple transformers in the same phase reject their " "configurations"
, | |
| 35 () { | |
| 36 d.dir(appPath, [d.pubspec({ | |
| 37 "name": "myapp", | |
| 38 "transformers": [[{ | |
| 39 "myapp/src/transformer": { | |
| 40 'foo': 'bar' | |
| 41 } | |
| 42 }, { | |
| 43 "myapp/src/transformer": { | |
| 44 'baz': 'bang' | |
| 45 } | |
| 46 }, { | |
| 47 "myapp/src/transformer": { | |
| 48 'qux': 'fblthp' | |
| 49 } | |
| 50 }]] | |
| 51 }), | |
| 52 d.dir( | |
| 53 "lib", | |
| 54 [ | |
| 55 d.dir( | |
| 56 "src", | |
| 57 [d.file("transformer.dart", REJECT_CONFIG_TRANSFORMER)])
])]).create(); | |
| 58 | |
| 59 createLockFile('myapp', pkg: ['barback']); | |
| 60 | |
| 61 // We should see three instances of the error message, once for each | |
| 62 // use of the transformer. | |
| 63 var pub = startPubServe(); | |
| 64 for (var i = 0; i < 3; i++) { | |
| 65 pub.stderr.expect( | |
| 66 consumeThrough( | |
| 67 endsWith('Error loading transformer: ' 'I hate these settings!')
)); | |
| 68 } | |
| 69 pub.shouldExit(1); | |
| 70 }); | |
| 71 }); | |
| 72 } | |
| OLD | NEW |