Files
sdk/pkg/front_end/testcases/general/constant_truncate.dart
T
Johnni Winther 56f46b0659 Remove non-nullable experiment flag from front_end test cases.
This changes the CFE expectation test suites to use unsound null safety
as default to avoid passing --enable-experiments=no-non-nullable to opt
out old test folders.

This change removes most test folders from the 'strong' tester, since
this now only supports sound null safety, which requires all libraries
to be opted in. Instead, the 'weak' tester now runs all test folders.
Additionally the 'outline' tester is changed to use unsound null safety
so that it call be used on all test folders.

The 'fast_strong' tester is removed since it should just be run locally
and it can be run by passing an option to the other testers.

References to non-existing 'shaker' folder has been removed from
testing.json.


Change-Id: Ibcc306f7b27d06b9637c205238bc408194f1d062
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184787
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-18 12:29:18 +00:00

118 lines
3.7 KiB
Dart

// Copyright (c) 2020, 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=2.9
const a0 = 0 ~/ 0; // error
const a1 = 0.0 ~/ 0; // error
const a2 = -0.0 ~/ 0; // error
const a3 = double.nan ~/ 0; // error
const a4 = double.infinity ~/ 0; // error
const a5 = double.negativeInfinity ~/ 0; // error
const b0 = 0 ~/ 0.0; // error
const b1 = 0.0 ~/ 0.0; // error
const b2 = -0.0 ~/ 0.0; // error
const b3 = double.nan ~/ 0.0; // error
const b4 = double.infinity ~/ 0.0; // error
const b5 = double.negativeInfinity ~/ 0.0; // error
const c0 = 0 ~/ -0.0; // error
const c1 = 0.0 ~/ -0.0; // error
const c2 = -0.0 ~/ -0.0; // error
const c3 = double.nan ~/ -0.0; // error
const c4 = double.infinity ~/ -0.0; // error
const c5 = double.negativeInfinity ~/ -0.0; // error
const d0 = 0 ~/ double.nan; // error
const d1 = 0.0 ~/ double.nan; // error
const d2 = -0.0 ~/ double.nan; // error
const d3 = double.nan ~/ double.nan; // error
const d4 = double.infinity ~/ double.nan; // error
const d5 = double.negativeInfinity ~/ double.nan; // error
const e0 = 0 ~/ double.infinity; // ok
const e1 = 0.0 ~/ double.infinity; // ok
const e2 = -0.0 ~/ double.infinity; // ok
const e3 = double.nan ~/ double.infinity; // error
const e4 = double.infinity ~/ double.infinity; // error
const e5 = double.negativeInfinity ~/ double.infinity; // error
const f0 = 0 ~/ double.negativeInfinity; // ok
const f1 = 0.0 ~/ double.negativeInfinity; // ok
const f2 = -0.0 ~/ double.negativeInfinity; // ok
const f3 = double.nan ~/ double.negativeInfinity; // error
const f4 = double.infinity ~/ double.negativeInfinity; // error
const f5 = double.negativeInfinity ~/ double.negativeInfinity; // error
main() {
test(0, 0, () => a0);
test(0.0, 0, () => a1);
test(-0.0, 0, () => a2);
test(double.nan, 0, () => a3);
test(double.infinity, 0, () => a4);
test(double.negativeInfinity, 0, () => a5);
test(0, 0.0, () => b0);
test(0.0, 0.0, () => b1);
test(-0.0, 0.0, () => b2);
test(double.nan, 0.0, () => b3);
test(double.infinity, 0.0, () => b4);
test(double.negativeInfinity, 0.0, () => b5);
test(0, -0.0, () => c0);
test(0.0, -0.0, () => c1);
test(-0.0, -0.0, () => c2);
test(double.nan, -0.0, () => c3);
test(double.infinity, -0.0, () => c4);
test(double.negativeInfinity, -0.0, () => c5);
test(0, double.nan, () => d0);
test(0.0, double.nan, () => d1);
test(-0.0, double.nan, () => d2);
test(double.nan, double.nan, () => d3);
test(double.infinity, double.nan, () => d4);
test(double.negativeInfinity, double.nan, () => d5);
test(0, double.infinity, () => e0);
test(0.0, double.infinity, () => e1);
test(-0.0, double.infinity, () => e2);
test(double.nan, double.infinity, () => e3);
test(double.infinity, double.infinity, () => e4);
test(double.negativeInfinity, double.infinity, () => e5);
test(0, double.negativeInfinity, () => f0);
test(0.0, double.negativeInfinity, () => f1);
test(-0.0, double.negativeInfinity, () => f2);
test(double.nan, double.negativeInfinity, () => f3);
test(double.infinity, double.negativeInfinity, () => f4);
test(double.negativeInfinity, double.negativeInfinity, () => f5);
}
void test(num a, num b, num Function() f) {
num result;
try {
result = a ~/ b;
print('$a ~/ $b = $result');
} catch (e) {
print('$a ~/ $b throws $e');
throws(f);
return;
}
expect(f(), result);
}
void expect(expected, actual) {
if (expected != actual) {
throw 'Expected $expected, actual $actual';
}
}
void throws(num Function() f) {
try {
f();
} catch (e) {
return;
}
throw 'Expected exception';
}