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 const TOKEN = "before"; |
25 foo() => TOKEN; | 26 foo() => TOKEN; |
26 """), | 27 """), |
27 d.file("transformer.dart", dartTransformer("munge")) | 28 d.file("transformer.dart", dartTransformer("munge")) |
28 ]) | 29 ]) |
29 ]).create(); | 30 ]).create(); |
30 | 31 |
31 d.dir(appPath, [ | 32 d.dir(appPath, [ |
32 d.appPubspec({ | 33 d.appPubspec({ |
33 "foo": { | 34 "foo": { |
34 "path": "../foo" | 35 "path": "../foo" |
35 } | 36 } |
36 }), | 37 }), |
37 d.dir("web", [ | 38 d.dir("web", [ |
38 d.file("main.dart", """ | 39 d.file("main.dart", """ |
39 import "package:foo/foo.dart"; | 40 import "package:foo/foo.dart"; |
40 main() => print(foo()); | 41 main() => print(foo()); |
41 """) | 42 """) |
42 ]) | 43 ]) |
43 ]).create(); | 44 ]).create(); |
44 | 45 |
45 pubGet(); | 46 pubGet(); |
46 pubServe(); | 47 pubServe(); |
47 requestShouldSucceed("main.dart.js", contains("(before, munge)")); | 48 requestShouldSucceed("main.dart.js", contains("(before, munge)")); |
48 endPubServe(); | 49 endPubServe(); |
49 }); | 50 }); |
50 } | 51 } |
OLD | NEW |