Added coverage for abrupt completion returning cases in ToNumber called by math#4881
Added coverage for abrupt completion returning cases in ToNumber called by math#4881
Conversation
81234df to
73ad89d
Compare
73ad89d to
2872db9
Compare
|
Can you name the files descriptively, please, instead of numbering them? (also, please be sure to not use an LLM for open source contributions) |
|
Thank you for the detailed feedback! Regarding the file names, I named them *-tonumber01... to keep them consistent with my previous PRs, but I understand your point. Also, just to clarify—I wrote all the code manually without using any LLMs. :) I realize that 77 files can be overwhelming to review, and I apologize for the heavy load. I grouped them together because they all share the exact same logic and format. Would it be better if I renamed them to something more descriptive like abs-tonumber-bigint? Please let me know if this works for you, or if you have a preferred naming convention! |
|
Yes, names like |
Hello.
This PR covers 26 cases of
Mathmethod where ToNumber is returned with an abrupt completion.I have added a total of 77 files. Aside from two specific cases (explained below), the remaining 75 files follow a consistent pattern to test the error-handling path of the
ToNumberoperation for eachMathmethod.1. Common Test Patterns (75 files)
*-tonumber01.js): when an argument is a BigInt, ToNumber throws a TypeError.*-tonumber02.js): when an argument is a Symbol, ToNumber throws a TypeError.*-tonumber03.js): when ToPrimitive is called and returns an abrupt completion.Specifically in this PR, I made ToPrimitive throw a TypeError by setting argument as
{toString: undefined, valueOf: undefined}so that ToPrimitive throws in its 1.d step, whereOrdinaryToPrimitive(O, hint) is called and throws in step 4.
2. Specific Cases (2 files)
These two were named differently because a similar example where ToNumber throws because of
valueOfexisted.Math.hypot_ToNumberErr02.js: when an argument is a BigInt, ToNumber throws a TypeError.Math.hypot_ToNumberErr03.js: when an argument is a Symbol, ToNumber throws a TypeError.Covered Methods
The tests cover the following 25
Mathmethods (3 files each):abs,acos,acosh,atan,atan2,cbrt,ceil,cos,cosh,exp,f16round,fround,imul,log,log10,log2,max,min,pow,round,sin,sinh,sqrt,tan,tanh.