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("multiple transformers in the same phase reject their " | |
34 "configurations", () { | |
35 d.dir(appPath, [ | |
36 d.pubspec({ | |
37 "name": "myapp", | |
38 "transformers": [[ | |
39 {"myapp/src/transformer": {'foo': 'bar'}}, | |
40 {"myapp/src/transformer": {'baz': 'bang'}}, | |
41 {"myapp/src/transformer": {'qux': 'fblthp'}} | |
42 ]] | |
43 }), | |
44 d.dir("lib", [d.dir("src", [ | |
45 d.file("transformer.dart", REJECT_CONFIG_TRANSFORMER) | |
46 ])]) | |
47 ]).create(); | |
48 | |
49 createLockFile('myapp', pkg: ['barback']); | |
50 | |
51 // We should see three instances of the error message, once for each | |
52 // use of the transformer. | |
53 var pub = startPubServe(); | |
54 for (var i = 0; i < 3; i++) { | |
55 pub.stderr.expect(consumeThrough(endsWith('Error loading transformer: ' | |
56 'I hate these settings!'))); | |
57 } | |
58 pub.shouldExit(1); | |
59 }); | |
60 }); | |
61 } | |
OLD | NEW |