Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataView.prototype.getBigInt64 tests #1284

Merged
merged 4 commits into from
Oct 26, 2017
Merged

Conversation

cxielarko
Copy link
Contributor

No description provided.

sample.setUint8(1, 2);
sample.setUint8(2, 6);
sample.setUint8(3, 2);
sample.setUint8(4, 128);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why you're passing 128 instead of 0 here.

sample.setUint8(11, 2);

testCoercibleToIndexZero(function (x) {
assert.sameValue(sample.getBigInt64(x), 2810815725239828481n);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified these and following tests by converting these numbers to hex in Python and seeing that they make sense. If you wanted to make these tests a little cleaner and more obvious to debug, you could use hex syntax instead.


$DETACHBUFFER(buffer);

assert.throws(TypeError, () => sample.getBigInt64(13), "13");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the message is "13", it could be something more descriptive, like "detached DataView access should throw".

var sample = new DataView(buffer, 0);

$DETACHBUFFER(buffer);
assert.throws(TypeError, () => sample.getBigInt64(0), "0");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the message is "0", it could be something more descriptive, like "detached DataView access should throw".

@littledan
Copy link
Member

The tests overall seem correct, but they could be cleaner. Would you mind making these small changes? (We're discussing whether code reviews should block on cleanups like this, but to stick with my understanding of current conventions, I'm requesting these minor changes.)

@cxielarko
Copy link
Contributor Author

I updated the tests to use hex literals and added better error messages

@littledan
Copy link
Member

LGTM!

@littledan littledan merged commit 70daaba into tc39:master Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants