OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2013, 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:scheduled_test/scheduled_test.dart'; | 5 import 'package:scheduled_test/scheduled_test.dart'; |
6 | 6 |
7 import '../descriptor.dart' as d; | 7 import '../descriptor.dart' as d; |
8 import '../test_pub.dart'; | 8 import '../test_pub.dart'; |
9 import '../serve/utils.dart'; | 9 import '../serve/utils.dart'; |
10 | 10 |
11 main() { | 11 main() { |
12 integration("compiles a Dart file that imports a generated file in another " | 12 integration("compiles a Dart file that imports a generated file in another " |
13 "package to JS", () { | 13 "package to JS", () { |
14 serveBarback(); | 14 serveBarback(); |
15 | 15 |
16 d.dir("foo", [ | 16 d.dir("foo", [ |
17 d.pubspec({ | 17 d.pubspec({ |
18 "name": "foo", | 18 "name": "foo", |
19 "version": "0.0.1", | 19 "version": "0.0.1", |
20 "transformers": ["foo/transformer"], | 20 "transformers": ["foo/transformer"], |
21 "dependencies": {"barback": "any"} | 21 "dependencies": {"barback": "any"} |
22 }), | 22 }), |
23 d.dir("lib", [ | 23 d.dir("lib", [ |
24 d.file("foo.dart", """ | 24 d.file("foo.dart", """ |
25 library foo; | |
26 const TOKEN = "before"; | |
27 foo() => TOKEN; | 25 foo() => TOKEN; |
28 """), | 26 """), |
29 d.file("transformer.dart", dartTransformer("munge")) | 27 d.file("transformer.dart", dartTransformer("munge")) |
30 ]) | 28 ]) |
31 ]).create(); | 29 ]).create(); |
32 | 30 |
33 d.dir(appPath, [ | 31 d.dir(appPath, [ |
34 d.appPubspec({ | 32 d.appPubspec({ |
35 "foo": { | 33 "foo": { |
36 "path": "../foo" | 34 "path": "../foo" |
37 } | 35 } |
38 }), | 36 }), |
39 d.dir("web", [ | 37 d.dir("web", [ |
40 d.file("main.dart", """ | 38 d.file("main.dart", """ |
41 import "package:foo/foo.dart"; | 39 import "package:foo/foo.dart"; |
42 main() => print(foo()); | 40 main() => print(foo()); |
43 """) | 41 """) |
44 ]) | 42 ]) |
45 ]).create(); | 43 ]).create(); |
46 | 44 |
47 pubGet(); | 45 pubGet(); |
48 pubServe(); | 46 pubServe(); |
49 requestShouldSucceed("main.dart.js", contains("(before, munge)")); | 47 requestShouldSucceed("main.dart.js", contains("(before, munge)")); |
50 endPubServe(); | 48 endPubServe(); |
51 }); | 49 }); |
52 } | 50 } |
OLD | NEW |