Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS 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 // Test of the graph segmentation algorithm used by deferred loading | 5 // Test of the graph segmentation algorithm used by deferred loading |
| 6 // to determine which elements can be deferred and which libraries | 6 // to determine which elements can be deferred and which libraries |
| 7 // much be included in the initial download (loaded eagerly). | 7 // much be included in the initial download (loaded eagerly). |
| 8 | 8 |
| 9 import 'package:expect/expect.dart'; | |
| 9 import 'dart:async' show Future; | 10 import 'dart:async' show Future; |
| 10 import 'dart:uri' show Uri; | 11 import 'dart:uri' show Uri; |
| 11 import 'dart:io'; | 12 import 'dart:io'; |
| 12 | 13 |
| 13 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' | 14 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' |
| 14 show Compiler; | 15 show Compiler; |
| 15 | 16 |
| 16 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 17 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
| 17 as dart2js; | 18 as dart2js; |
| 18 | 19 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 const Map MEMORY_SOURCE_FILES = const { | 80 const Map MEMORY_SOURCE_FILES = const { |
| 80 'main.dart': """ | 81 'main.dart': """ |
| 81 import 'dart:async'; | 82 import 'dart:async'; |
| 82 | 83 |
| 83 @lazy import 'deferred.dart'; | 84 @lazy import 'deferred.dart'; |
| 84 | 85 |
| 85 const lazy = const DeferredLibrary('deferred'); | 86 const lazy = const DeferredLibrary('deferred'); |
| 86 | 87 |
| 87 main() { | 88 main() { |
| 88 lazy.load().then((_) { | 89 lazy.load().then((_) { |
| 89 Expect.equals(42, new MyClass().foo(87)); | 90 if (42 != new MyClass().foo(87)) throw "not equal"; |
|
ngeoffray
2013/04/10 09:49:44
Why this change if you're importing expect?
floitsch
2013/04/10 10:46:10
This is inside a Dart script that is generated and
| |
| 90 }); | 91 }); |
| 91 } | 92 } |
| 92 | 93 |
| 93 """, | 94 """, |
| 94 'deferred.dart': """ | 95 'deferred.dart': """ |
| 95 library deferred; | 96 library deferred; |
| 96 | 97 |
| 97 class MyClass { | 98 class MyClass { |
| 98 const MyClass(); | 99 const MyClass(); |
| 99 | 100 |
| 100 foo(x) { | 101 foo(x) { |
| 101 new Expando(); | 102 new Expando(); |
| 102 return (x - 3) ~/ 2; | 103 return (x - 3) ~/ 2; |
| 103 } | 104 } |
| 104 } | 105 } |
| 105 """, | 106 """, |
| 106 }; | 107 }; |
| OLD | NEW |