[tests] Update some tests for web numbers

Change-Id: I6cf7925779a93cae082e23c2bdf15ac36016eeb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333127
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This commit is contained in:
Stephen Adams 2023-11-02 19:30:11 +00:00 committed by Commit Queue
parent 0e196c2d9d
commit 3595f1e187
2 changed files with 9 additions and 4 deletions

View file

@ -13,18 +13,18 @@ class NumbersTest {
Expect.equals(true, one is Object);
Expect.equals(true, one is num);
Expect.equals(true, one is int);
Expect.equals(false, one is double);
Expect.equals(webNumbers, one is double);
var two = 2.0;
Expect.equals(true, two is Object);
Expect.equals(true, two is num);
Expect.equals(false, two is int);
Expect.equals(webNumbers, two is int);
Expect.equals(true, two is double);
var result = one + two;
Expect.equals(true, result is Object);
Expect.equals(true, result is num);
Expect.equals(false, result is int);
Expect.equals(webNumbers, result is int);
Expect.equals(true, result is double);
Expect.equals(3.0, result);

View file

@ -9,6 +9,11 @@ import "package:expect/expect.dart";
import "truncdiv_test.dart" as truncdiv_test show foo, foo2;
main() {
if (!webNumbers) {
Expect.throws<UnsupportedError>(() => truncdiv_test.foo(12, 0));
} else {
// Web numbers consider infinities to be large-magnitide 'int' values.
truncdiv_test.foo(12, 0);
}
Expect.throws<UnsupportedError>(() => truncdiv_test.foo2(0));
}