-
Notifications
You must be signed in to change notification settings - Fork 464
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
Improve tests for BigInt.prototype.valueOf #1256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me!
info: > | ||
description: > | ||
BigInt.prototype.valueOf returns the primitive BigInt value. | ||
info: | | ||
BigInt.prototype.valueOf ( ) | ||
|
||
Return ? thisBigIntValue(this value). | ||
includes: [typeCoercion.js] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to remove the includes... That's why the linter triggered an error
@spectranaut the commits d729577 and b307b80 should fix the remaining parts. |
var valueOf = BigInt.prototype.valueOf; | ||
|
||
assert.sameValue(valueOf.call(0n), 0n, "0n"); | ||
assert.sameValue(valueOf.call(Object(0n)), 0n, "Object(0n)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
var s = Symbol(); | ||
assert.throws(TypeError, function() { | ||
valueOf.call(s); | ||
}, "symbol"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clear, glad to see the helper going away where possible. Thanks for taking the extra time to refine these.
Note that although there were only valueOf tests checked in which used this infrastructure, there are more places in the spec where it would be applicable, namely in BigInt.prototype.toString and toLocaleString. cc @thejoshwolfe @cxielarko |
There is a PR for toString already which I'm working to apply fixes at this very moment. We should have an update soon. |
No description provided.