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("handles imports in the Dart code", () { | 12 integration("handles imports in the Dart code", () { |
13 d.dir("foo", [ | 13 d.dir("foo", [ |
14 d.libPubspec("foo", "0.0.1"), | 14 d.libPubspec("foo", "0.0.1"), |
15 d.dir("lib", [ | 15 d.dir("lib", [ |
16 d.file("foo.dart", """ | 16 d.file("foo.dart", """ |
17 library foo; | |
18 foo() => 'footext'; | |
19 """) | 17 """) |
20 ]) | 18 ]) |
21 ]).create(); | 19 ]).create(); |
22 | 20 |
23 d.dir(appPath, [ | 21 d.dir(appPath, [ |
24 d.appPubspec({ | 22 d.appPubspec({ |
25 "foo": {"path": "../foo"} | 23 "foo": {"path": "../foo"} |
26 }), | 24 }), |
27 d.dir("lib", [ | 25 d.dir("lib", [ |
28 d.file("lib.dart", """ | 26 d.file("lib.dart", """ |
29 library lib; | |
30 lib() => 'libtext'; | |
31 """) | 27 """) |
32 ]), | 28 ]), |
33 d.dir("web", [ | 29 d.dir("web", [ |
34 d.file("main.dart", """ | 30 d.file("main.dart", """ |
35 import 'package:foo/foo.dart'; | 31 import 'package:foo/foo.dart'; |
36 import 'package:myapp/lib.dart'; | 32 import 'package:myapp/lib.dart'; |
37 void main() { | 33 void main() { |
38 print(foo()); | 34 print(foo()); |
39 print(lib()); | 35 print(lib()); |
40 } | 36 } |
41 """) | 37 """) |
42 ]) | 38 ]) |
43 ]).create(); | 39 ]).create(); |
44 | 40 |
45 pubGet(); | 41 pubGet(); |
46 pubServe(); | 42 pubServe(); |
47 requestShouldSucceed("main.dart.js", contains("footext")); | 43 requestShouldSucceed("main.dart.js", contains("footext")); |
48 requestShouldSucceed("main.dart.js", contains("libtext")); | 44 requestShouldSucceed("main.dart.js", contains("libtext")); |
49 endPubServe(); | 45 endPubServe(); |
50 }); | 46 }); |
51 } | 47 } |
OLD | NEW |