Skip to content

Commit 0272c1d

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
Split language_2/truncdiv_test
Move zero case out to increase coverage of non-zero cases. Change-Id: Iaa3a1dbe1fc952bcccb16dca2f6543a9d367d61c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107826 Reviewed-by: Lasse R.H. Nielsen <[email protected]> Commit-Queue: Lasse R.H. Nielsen <[email protected]> Auto-Submit: Stephen Adams <[email protected]>
1 parent 4babccd commit 0272c1d

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

tests/language_2/language_2_dart2js.status

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ super_bound_closure_test/none: CompileTimeError
194194
super_call4_test/01: MissingCompileTimeError
195195
super_test: RuntimeError
196196
tearoff_dynamic_test: RuntimeError
197-
truncdiv_test: RuntimeError # non JS number semantics - Issue 15246
197+
truncdiv_zero_test: RuntimeError # non JS number semantics - Issue 15246
198198
type_constants_test/none: RuntimeError # Issue 35052
199199
type_error_test: RuntimeError
200200
type_literal_canonicalization_test: RuntimeError
@@ -491,7 +491,7 @@ stacktrace_rethrow_nonerror_test: RuntimeError # Issue 12698
491491
stacktrace_test: RuntimeError # Issue 12698
492492
symbol_literal_test/01: MissingCompileTimeError
493493
tearoff_dynamic_test: RuntimeError
494-
truncdiv_test: RuntimeError # non JS number semantics - Issue 15246
494+
truncdiv_zero_test: RuntimeError # non JS number semantics - Issue 15246
495495
type_check_const_function_typedef2_test: MissingCompileTimeError
496496
type_literal_canonicalization_test: RuntimeError
497497
type_parameter_test/06: Crash # Internal Error: Unexpected type variable in static context.

tests/language_2/truncdiv_test.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ main() {
1616
Expect.equals(i ~/ i, foo2(i));
1717
}
1818
}
19-
Expect.throws(() => foo(12, 0), (e) => e is IntegerDivisionByZeroException);
20-
Expect.throws(() => foo2(0), (e) => e is IntegerDivisionByZeroException);
19+
// We don't specify the exact exception type here, that is covered in
20+
// truncdiv_zero_test. The correct answer is IntegerDivisionByZeroException,
21+
// but the web platform has only one num type and can't distinguish between
22+
// int and double, so it throws UnsupportedError (the behaviour for double).
23+
Expect.throws(() => foo2(0));
2124
}
2225

2326
foo(i, x) => i % x;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
// Dart test optimization of modulo operator on Smi.
5+
// VMOptions=--optimization-counter-threshold=10 --no-use-osr
6+
7+
import "package:expect/expect.dart";
8+
9+
import "truncdiv_test.dart" as truncdiv_test show foo, foo2;
10+
11+
main() {
12+
Expect.throws<IntegerDivisionByZeroException>(() => truncdiv_test.foo(12, 0));
13+
Expect.throws<IntegerDivisionByZeroException>(() => truncdiv_test.foo2(0));
14+
}

0 commit comments

Comments
 (0)