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 library pub_tests; | |
6 | |
7 import 'package:path/path.dart' as p; | |
8 import 'package:scheduled_test/scheduled_test.dart'; | |
9 | |
10 import '../descriptor.dart' as d; | |
11 import '../test_pub.dart'; | |
12 | |
13 const BROKEN_TRANSFORMER = """ | |
14 import 'dart:async'; | |
15 | |
16 import 'package:barback/barback.dart'; | |
17 | |
18 class BrokenTransformer extends Transformer { | |
19 BrokenTransformer.asPlugin(); | |
20 | |
21 // This file intentionally has a syntax error so that any attempt to load it | |
22 // will crash. | |
23 """; | |
24 | |
25 main() { | |
26 initConfig(); | |
27 | |
28 // Regression test for issue 20917. | |
29 integration("snapshots the transformed version of an executable", () { | |
30 servePackages((builder) { | |
31 builder.serveRepoPackage('barback'); | |
32 | |
33 builder.serve("foo", "1.2.3", | |
34 contents: [ | |
35 d.dir("bin", [ | |
36 d.file("hello.dart", "void main() => print('hello!');") | |
37 ]) | |
38 ]); | |
39 }); | |
40 | |
41 d.dir(appPath, [ | |
42 d.pubspec({ | |
43 "name": "myapp", | |
44 "dependencies": { | |
45 "foo": "1.2.3", | |
46 "barback": "any" | |
47 }, | |
48 "transformers": ["myapp"] | |
49 }), | |
50 d.dir("lib", [ | |
51 d.file("transformer.dart", BROKEN_TRANSFORMER) | |
52 ]) | |
53 ]).create(); | |
54 | |
55 pubGet(output: contains("Precompiled foo:hello.")); | |
56 | |
57 d.dir(p.join(appPath, '.pub', 'bin'), [ | |
58 d.dir('foo', [d.matcherFile('hello.dart.snapshot', contains('hello!'))]) | |
59 ]).validate(); | |
60 | |
61 var process = pubRun(args: ['foo:hello']); | |
62 process.stdout.expect("hello!"); | |
63 process.shouldExit(); | |
64 }); | |
65 } | |
OLD | NEW |