Skip to content

Conversation

@matedabis
Copy link
Contributor

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 mdabis@inf.u-szeged.hu

Array.prototype.toLocaleString.call(obj);
assert(false);
} catch (e) {
assert(e instanceof ReferenceError);
Copy link
Member

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)

Copy link
Member

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?

Copy link
Member

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.

Copy link
Contributor Author

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 ReferenceErrors, so as I check the message, I get assertion fail.

Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

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

typo: wichs

@rerobika rerobika added the test Related to testing label Jan 19, 2019
@matedabis
Copy link
Contributor Author

Corrected according to the reviews.
Replying to this comment: #2716 (comment)
in the get function, and which is being catched are not the same ReferenceErrors, as I check the message, I get assertion fail.

assert (e instanceof ReferenceError);
}

// Checking behavior when null is passed to the function
Copy link
Member

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.

@matedabis
Copy link
Contributor Author

I updated the patch according to the review.

Array.prototype.toLocaleString.call(obj);
assert(false);
} catch (e) {
assert(e instanceof ReferenceError);
Copy link
Member

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
Copy link
Member

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

@matedabis
Copy link
Contributor Author

Corrected the patch according to the review.

@matedabis
Copy link
Contributor Author

Updated the patch:

  • Added comments for each case containing which part of the ES 5.1 it tests.
  • Ran the test code in Gecko, V8, SpiderMonkey engines and got the same result.

@matedabis
Copy link
Contributor Author

Corrected the issue above.

Branch coverage:
Before: 15/18
After: 18/18

JerryScript-DCO-1.0-Signed-off-by: Mate Dabis mdabis@inf.u-szeged.hu
@matedabis
Copy link
Contributor Author

Changed comment style.

@matedabis
Copy link
Contributor Author

Closing PR because of moving to another branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants