| 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(); |
| 15 |
| 14 d.dir("foo", [ | 16 d.dir("foo", [ |
| 15 d.pubspec({ | 17 d.pubspec({ |
| 16 "name": "foo", | 18 "name": "foo", |
| 17 "version": "0.0.1", | 19 "version": "0.0.1", |
| 18 "transformers": ["foo/transformer"] | 20 "transformers": ["foo/transformer"], |
| 21 "dependencies": {"barback": "any"} |
| 19 }), | 22 }), |
| 20 d.dir("lib", [ | 23 d.dir("lib", [ |
| 21 d.file("foo.dart", """ | 24 d.file("foo.dart", """ |
| 22 library foo; | 25 library foo; |
| 23 const TOKEN = "before"; | 26 const TOKEN = "before"; |
| 24 foo() => TOKEN; | 27 foo() => TOKEN; |
| 25 """), | 28 """), |
| 26 d.file("transformer.dart", dartTransformer("munge")) | 29 d.file("transformer.dart", dartTransformer("munge")) |
| 27 ]) | 30 ]) |
| 28 ]).create(); | 31 ]).create(); |
| 29 | 32 |
| 30 d.dir(appPath, [ | 33 d.dir(appPath, [ |
| 31 d.appPubspec({ | 34 d.appPubspec({ |
| 32 "foo": { | 35 "foo": { |
| 33 "path": "../foo" | 36 "path": "../foo" |
| 34 } | 37 } |
| 35 }), | 38 }), |
| 36 d.dir("web", [ | 39 d.dir("web", [ |
| 37 d.file("main.dart", """ | 40 d.file("main.dart", """ |
| 38 import "package:foo/foo.dart"; | 41 import "package:foo/foo.dart"; |
| 39 main() => print(foo()); | 42 main() => print(foo()); |
| 40 """) | 43 """) |
| 41 ]) | 44 ]) |
| 42 ]).create(); | 45 ]).create(); |
| 43 | 46 |
| 44 createLockFile("myapp", sandbox: ["foo"], pkg: ["barback"]); | 47 pubGet(); |
| 45 | |
| 46 pubServe(); | 48 pubServe(); |
| 47 requestShouldSucceed("main.dart.js", contains("(before, munge)")); | 49 requestShouldSucceed("main.dart.js", contains("(before, munge)")); |
| 48 endPubServe(); | 50 endPubServe(); |
| 49 }); | 51 }); |
| 50 } | 52 } |
| OLD | NEW |