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

Unified Diff: pkg/dev_compiler/test/browser/runtime_tests.js

Issue 2772573003: Handle casts from Number to FutureOr<double>. (Closed)
Patch Set: Formatting Created 3 years, 9 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
Index: pkg/dev_compiler/test/browser/runtime_tests.js
diff --git a/pkg/dev_compiler/test/browser/runtime_tests.js b/pkg/dev_compiler/test/browser/runtime_tests.js
index 3cb562aff0a9c56993f84bc34d6f72d67b77e3f2..acce540dd37d1bf196577a5ffb2578878ac2fd71 100644
--- a/pkg/dev_compiler/test/browser/runtime_tests.js
+++ b/pkg/dev_compiler/test/browser/runtime_tests.js
@@ -132,6 +132,7 @@ define(['dart_sdk'], function(dart_sdk) {
let List = core.List;
let Map = core.Map;
let Map$ = core.Map$;
+ let double = core.double;
let int = core.int;
let num = core.num;
let bool = core.bool;
@@ -283,6 +284,23 @@ define(['dart_sdk'], function(dart_sdk) {
expect(cast(null, String), null);
});
+ test('FutureOr', () => {
+ let FutureOr = async.FutureOr$;
+
+ assert.equal(dart.as(3, FutureOr(int)), 3);
+ assert.equal(dart.as(3, FutureOr(double)), 3);
+ assert.throws(() => dart.as(3.5, FutureOr(int)));
+ assert.equal(dart.as(3.5, FutureOr(double)), 3.5);
+ assert.isTrue(dart.is(3, FutureOr(int)));
+ assert.isTrue(dart.is(3, FutureOr(double)));
+ assert.isFalse(dart.is(3.5, FutureOr(int)));
+ assert.isTrue(dart.is(3.5, FutureOr(double)));
+
+ assert.equal(dart.as(3, FutureOr(FutureOr(double))), 3);
+ assert.isTrue(dart.is(3, FutureOr(FutureOr(double))));
+
+ });
+
test('Map', () => {
let m1 = new (Map$(String, String))();
let m2 = new (Map$(Object, Object))();
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698