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