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 <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Auto-Submit: Stephen Adams <sra@google.com>
This commit is contained in:
Stephen Adams 2019-07-04 07:58:05 +00:00 committed by commit-bot@chromium.org
parent 4babccd988
commit 0272c1d863
3 changed files with 21 additions and 4 deletions

View file

@ -194,7 +194,7 @@ super_bound_closure_test/none: CompileTimeError
super_call4_test/01: MissingCompileTimeError
super_test: RuntimeError
tearoff_dynamic_test: RuntimeError
truncdiv_test: RuntimeError # non JS number semantics - Issue 15246
truncdiv_zero_test: RuntimeError # non JS number semantics - Issue 15246
type_constants_test/none: RuntimeError # Issue 35052
type_error_test: RuntimeError
type_literal_canonicalization_test: RuntimeError
@ -491,7 +491,7 @@ stacktrace_rethrow_nonerror_test: RuntimeError # Issue 12698
stacktrace_test: RuntimeError # Issue 12698
symbol_literal_test/01: MissingCompileTimeError
tearoff_dynamic_test: RuntimeError
truncdiv_test: RuntimeError # non JS number semantics - Issue 15246
truncdiv_zero_test: RuntimeError # non JS number semantics - Issue 15246
type_check_const_function_typedef2_test: MissingCompileTimeError
type_literal_canonicalization_test: RuntimeError
type_parameter_test/06: Crash # Internal Error: Unexpected type variable in static context.

View file

@ -16,8 +16,11 @@ main() {
Expect.equals(i ~/ i, foo2(i));
}
}
Expect.throws(() => foo(12, 0), (e) => e is IntegerDivisionByZeroException);
Expect.throws(() => foo2(0), (e) => e is IntegerDivisionByZeroException);
// We don't specify the exact exception type here, that is covered in
// truncdiv_zero_test. The correct answer is IntegerDivisionByZeroException,
// but the web platform has only one num type and can't distinguish between
// int and double, so it throws UnsupportedError (the behaviour for double).
Expect.throws(() => foo2(0));
}
foo(i, x) => i % x;

View file

@ -0,0 +1,14 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Dart test optimization of modulo operator on Smi.
// VMOptions=--optimization-counter-threshold=10 --no-use-osr
import "package:expect/expect.dart";
import "truncdiv_test.dart" as truncdiv_test show foo, foo2;
main() {
Expect.throws<IntegerDivisionByZeroException>(() => truncdiv_test.foo(12, 0));
Expect.throws<IntegerDivisionByZeroException>(() => truncdiv_test.foo2(0));
}