Skip to content

Commit

Permalink
[tests] Update some tests for web numbers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rakudrama authored and Commit Queue committed Nov 2, 2023
1 parent 0e196c2 commit 3595f1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/language/number/numbers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion tests/language/operator/truncdiv_zero_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import "package:expect/expect.dart";
import "truncdiv_test.dart" as truncdiv_test show foo, foo2;

main() {
Expect.throws<UnsupportedError>(() => truncdiv_test.foo(12, 0));
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));
}

0 comments on commit 3595f1e

Please sign in to comment.