-
Notifications
You must be signed in to change notification settings - Fork 686
Increase test coverage: Array.prototype.indexOf #2685
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
| } | ||
|
|
||
| // Checking behavior when values are unable to find | ||
| try{ |
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.
Space before {.
|
|
||
| // Checking behavior when values are unable to find | ||
| try{ | ||
| var a = [undefined,undefined,undefined,undefined,undefined]; |
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.
Space after ,.
| try{ | ||
| var a = [undefined,undefined,undefined,undefined,undefined]; | ||
| for(var i=0; i<a.length; i++) | ||
| {delete a[i];} |
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.
Spaces around =, <, moreover:
for (...) {
//...
}| var a = [undefined,undefined,undefined,undefined,undefined]; | ||
| for(var i=0; i<a.length; i++) | ||
| {delete a[i];} | ||
| a.indexOf("bar"); |
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.
assert (false);
| for(var i=0; i<a.length; i++) | ||
| {delete a[i];} | ||
| a.indexOf("bar"); | ||
| } catch (e) { } |
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.
assert (e instanceof TypeError)
| } catch (e) { } | ||
|
|
||
| // Checking behavior when value is null | ||
| try{ |
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.
Ditto.
| try { | ||
| var a = [0, 1, 2, 3, 4]; | ||
| Object.defineProperty(a, '0', { 'get' : function () { throw new ReferenceError; } }); | ||
| Array.prototype.indexOf.call(a, "bar") |
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.
assert (false).
| a.indexOf("bar"); | ||
| } catch (e) { } | ||
|
|
||
| // Checking behavior when value is null |
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.
// Checking behavior when this value is not coercible to object.
| assert (e instanceof ReferenceError); | ||
| } | ||
|
|
||
| // checking behavior when unable to get the first element |
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.
checking -> Checking
Branch coverage: Before: 22/26 After: 26/26 JerryScript-DCO-1.0-Signed-off-by: Mate Dabis mdabis@inf.u-szeged.hu
|
Corrected |
| for (var i = 0; i < a.length; i++) { | ||
| delete a[i]; | ||
| } | ||
| a.indexOf("bar"); |
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.
Check the expected behavior!
| Array.prototype.indexOf.call(a, function () { }); | ||
| 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.
Add an assert for e.message
| Array.prototype.indexOf.call(a, "bar"); | ||
| 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.
Ditto.
|
@matedabis Could you please give details similar to those requested at #2674 (comment) . I.e., which source file(s) or source file entity(-ies) (function(s)) are investigated, and what is the coverage result when all test suites of the project are executed (i.e., what is the actual baseline)? |
|
@akosthekiss |
akosthekiss
left a comment
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'd like to have this on hold until validity questions are sorted out at #2674 .
|
Closing pull request because the updated version of the coverage tester script wich runs |
Branch coverage:
Before: 22/26
After: 26/26
JerryScript-DCO-1.0-Signed-off-by: Mate Dabis mdabis@inf.u-szeged.hu