OLD | NEW |
(Empty) | |
| 1 import 'package:scheduled_test/scheduled_test.dart'; |
| 2 import '../descriptor.dart' as d; |
| 3 import '../test_pub.dart'; |
| 4 const MAIN = """ |
| 5 import 'dart:async'; |
| 6 |
| 7 import 'a.dart' deferred as a; |
| 8 import 'b.dart' deferred as b; |
| 9 |
| 10 void main() { |
| 11 Future.wait([lazyA.loadLibrary(), lazyB.loadLibrary()]).then((_) { |
| 12 a.fn(); |
| 13 b.fn(); |
| 14 }); |
| 15 } |
| 16 """; |
| 17 const A = """ |
| 18 library a; |
| 19 |
| 20 fn() => print("a"); |
| 21 """; |
| 22 const B = """ |
| 23 library b; |
| 24 |
| 25 fn() => print("b"); |
| 26 """; |
| 27 main() { |
| 28 initConfig(); |
| 29 integration("compiles deferred libraries to separate outputs", () { |
| 30 currentSchedule.timeout *= 3; |
| 31 d.dir( |
| 32 appPath, |
| 33 [ |
| 34 d.appPubspec(), |
| 35 d.dir( |
| 36 'web', |
| 37 [ |
| 38 d.file('main.dart', MAIN), |
| 39 d.file('a.dart', A), |
| 40 d.file('b.dart', B)])]).create(); |
| 41 schedulePub( |
| 42 args: ["build"], |
| 43 output: new RegExp(r'Built 4 files to "build".')); |
| 44 d.dir( |
| 45 appPath, |
| 46 [ |
| 47 d.dir( |
| 48 'build', |
| 49 [ |
| 50 d.dir( |
| 51 'web', |
| 52 [ |
| 53 d.matcherFile('main.dart.js', isNot(isEmpty)), |
| 54 d.matcherFile('main.dart.precompiled.js', isNot(isEm
pty)), |
| 55 d.matcherFile('main.dart.js_1.part.js', isNot(isEmpt
y)), |
| 56 d.matcherFile('main.dart.js_2.part.js', isNot(isEmpt
y))])])]).validate(); |
| 57 }); |
| 58 } |
OLD | NEW |