Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: dart/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart

Issue 16580014: Don't create part.js when there is no deferred loading. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/tests/compiler/dart2js/unneeded_part_js_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
diff --git a/dart/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart b/dart/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
index c5980fb6c18a1e4aa546635cca4a40621bc9d33b..3f15bec66fd78706001659e85ae821c85e497657 100644
--- a/dart/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
+++ b/dart/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
@@ -13,16 +13,25 @@ const lazy = const DeferredLibrary('deferred_function_library');
isNoSuchMethodError(e) => e is NoSuchMethodError;
+readFoo() {
+ // TODO(ahe): There is a problem with type inference of deferred
+ // function closures. We think they are never null.
+ if (new DateTime.now().millisecondsSinceEpoch == 87) return null;
+ return foo;
+}
+
main() {
print('unittest-suite-wait-for-done');
Expect.throws(() { foo('a'); }, isNoSuchMethodError);
+ Expect.isNull(readFoo());
int counter = 0;
lazy.load().then((bool didLoad) {
Expect.isTrue(didLoad);
Expect.equals(1, ++counter);
print('lazy was loaded');
Expect.equals(42, foo('b'));
+ Expect.isNotNull(readFoo());
});
Expect.equals(0, counter);
lazy.load().then((bool didLoad) {
@@ -30,8 +39,10 @@ main() {
Expect.equals(2, ++counter);
print('lazy was loaded');
Expect.equals(42, foo('b'));
+ Expect.isNotNull(readFoo());
print('unittest-suite-success');
});
Expect.equals(0, counter);
Expect.throws(() { foo('a'); }, isNoSuchMethodError);
+ Expect.isNull(readFoo());
}
« no previous file with comments | « dart/tests/compiler/dart2js/unneeded_part_js_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698