From 3595f1e187c090021fb29ce8c60796da17f96cd8 Mon Sep 17 00:00:00 2001 From: Stephen Adams Date: Thu, 2 Nov 2023 19:30:11 +0000 Subject: [PATCH] [tests] Update some tests for web numbers Change-Id: I6cf7925779a93cae082e23c2bdf15ac36016eeb5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333127 Reviewed-by: Mark Zhou Commit-Queue: Stephen Adams --- tests/language/number/numbers_test.dart | 6 +++--- tests/language/operator/truncdiv_zero_test.dart | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/language/number/numbers_test.dart b/tests/language/number/numbers_test.dart index e7c8a75bf40..5a4e8d17beb 100644 --- a/tests/language/number/numbers_test.dart +++ b/tests/language/number/numbers_test.dart @@ -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); diff --git a/tests/language/operator/truncdiv_zero_test.dart b/tests/language/operator/truncdiv_zero_test.dart index 11f0bb4b2bb..989626b3579 100644 --- a/tests/language/operator/truncdiv_zero_test.dart +++ b/tests/language/operator/truncdiv_zero_test.dart @@ -9,6 +9,11 @@ import "package:expect/expect.dart"; import "truncdiv_test.dart" as truncdiv_test show foo, foo2; main() { - Expect.throws(() => truncdiv_test.foo(12, 0)); + if (!webNumbers) { + Expect.throws(() => truncdiv_test.foo(12, 0)); + } else { + // Web numbers consider infinities to be large-magnitide 'int' values. + truncdiv_test.foo(12, 0); + } Expect.throws(() => truncdiv_test.foo2(0)); }