Skip to content

Commit

Permalink
corelib_2/unsigned_shift_test fixes
Browse files Browse the repository at this point in the history
Just doing some test cleanup on massively failing tests. This test still won't pass until we support `>>>` but we can fix some of the issues.

Change-Id: I1a111455c969f21644ab2713f81f4ee00e7383f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115881
Auto-Submit: Mayank Patke <fishythefish@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
  • Loading branch information
fishythefish authored and commit-bot@chromium.org committed Sep 6, 2019
1 parent 6f4ceb8 commit a689f8d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/corelib_2/unsigned_shift_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void testIntegerShifts() {
}
}

void testNonDoublesShift() {
void testNonDoubleShifts() {
double n = 0.0;
n >>> 1; //# 01: compile-time error
for (dynamic number in [0.0, 1.0, 2.4, -2.4, double.infinity, double.nan]) {
Expand All @@ -60,25 +60,25 @@ int testConstantShifts() {
// >>> is a constant operation on integers.
const c1 = 2 >>> 1;
const c2 = (1 >>> 0) >>> 0;
// >> is a potentially constant operation independent of type.
// >>> is a potentially constant operation independent of type.
// The type must still type-check.
const c3 = false ? 1 : c >>> c;
const c4 = true || c >>> c;

// It's an error if it doesn't type-check.
const c5 = true || "string" >>> 1; //# 02: compile-time error
const c4 = true || c >>> c; //# 02: compile-time error
const c5 = true || "string" >>> 1; //# 03: compile-time error

// Or if the shift isn't on integers and it is evaluated.
const c6 = c >>> c; //# 03: compile-time error
const c6 = c >>> c; //# 04: compile-time error

// Or if shifting throws
const c7 = 1 >>> -1; //# 04: compile-time error
const c8 = 1 >>> 65; //# 05: compile-time error
const c7 = 1 >>> -1; //# 05: compile-time error
const c8 = 1 >>> 65; //# 06: compile-time error

Expect.notNull(c1 + c2 + c3 + c4); // Avoid "unused variable" warnings.
Expect.isNotNull(c1 + c2 + c3); // Avoid "unused variable" warnings.
}

const bool isJSBitOps => (-1 | 0) > 0;
const bool isJSBitOps = (-1 | 0) > 0;
const String jsFlag = isJSBitOps ? " (JS)" : "";

void testShift(int value, int shift) {
Expand All @@ -94,7 +94,7 @@ void testShift(int value, int shift) {
return;
}
var expected;
if (isJsBitOps) {
if (isJSBitOps) {
// TODO: Check that this is the desired behavior for JS >>>.
expected = value.toUnsigned(32) >> shift;
} else if (value < 0) {
Expand Down

0 comments on commit a689f8d

Please sign in to comment.