-
Notifications
You must be signed in to change notification settings - Fork 684
Increase test coverage: Array.prototype.toLocaleString #2716
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
Conversation
Array.prototype.toLocaleString.call(obj); | ||
assert(false); | ||
} catch (e) { | ||
assert(e instanceof ReferenceError); |
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.
Please check the message as well! (And use unique messages)
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.
The message is not checked. Why is this marked as resolved?
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.
@akosthekiss Probably that was a miss click, I've just unresolved it.
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.
The thrown error and the one in the function are not the same ReferenceError
s, so as I check the message, I get assertion fail.
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.
Something is not right then. Q1: Why set the error message then, if it cannot be checked? Q2: Does the error object get replaced somewhere by the builtin implementation? Q3: If yes, why? Q4: If yes, is it necessary to throw a reference error within the anonymous function or any kind of error can be thrown?
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.
Something is a bit fishy there.
try {
var obj = {};
Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError("foo"); } });
Array.prototype.toLocaleString.call(obj);
assert(false);
} catch (e) {
assert(e instanceof ReferenceError);
assert (e.message == "foo");
}
The suggested assertion for the message is correct in all engines that I've tested (V8, Spidermonkey, JSC) even in Jerry as well. Could you please give more detailed description about why this assert is failing?
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.
Sorry I made a typo, that is why it did not work.
assert(e instanceof ReferenceError); | ||
} | ||
|
||
// Checking behavior when length is an object, wichs valueOf throws error |
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.
typo: wichs
c15e190
to
d7a9fc9
Compare
Corrected according to the reviews. |
@@ -54,3 +54,34 @@ try { | |||
assert (e.message === "foo"); | |||
assert (e instanceof ReferenceError); | |||
} | |||
|
|||
// Checking behavior when null is passed to the function |
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.
This description is a bit misleading. I'd suggest the same as in #2717.
d7a9fc9
to
f833585
Compare
I updated the patch according to the review. |
Array.prototype.toLocaleString.call(obj); | ||
assert(false); | ||
} catch (e) { | ||
assert(e instanceof ReferenceError); |
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.
The message is not checked. Why is this marked as resolved?
assert(e instanceof ReferenceError); | ||
} | ||
|
||
// Checking behavior when length is an object, whichs valueOf throws error |
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.
typo: whichs --> which has a valueOf method that throws an error
f833585
to
2665841
Compare
Corrected the patch according to the review. |
2665841
to
97d13e1
Compare
Updated the patch:
|
97d13e1
to
74bd487
Compare
Corrected the issue above. |
Branch coverage: Before: 15/18 After: 18/18 JerryScript-DCO-1.0-Signed-off-by: Mate Dabis [email protected]
74bd487
to
38b8655
Compare
Changed comment style. |
Closing PR because of moving to another branch. |
The coverage is measured by the following script, using
--jerry-test-suite --test262 --unittests --jerry-tests
:https://github.com/matedabis/jerryscript/blob/gcov_coverage_tester/tests/gcov-tests/gcovtester.py
Branch coverage:
Before: 15/18
After: 18/18
JerryScript-DCO-1.0-Signed-off-by: Mate Dabis [email protected]