This re-factors some existing Sputnik tests to be more targeted and to use a
pattern that can be generalized to other forms. We could test these all day,
but I've limited myself to forms introduced in ES2015, specifically
YieldExpression and new.target. Note that SpiderMonkey incorrectly throws a
SyntaxError for these.
I thoughtlessly wrote ReferenceError tests for yield = 1 until I realized
that such productions are not actually recognized by the grammar, so the early
errors do not apply. Instead, I've added a negative syntax test for that case.
* Refactor test for valid cover
* Add tests for ValidSimpleAssignmentTarget
Ensure that constructs introduced in ES2015 are disallowed as assignment
targets, with or without a "cover" grammar.
* Add test for grammar precedence of YieldExpression
This changeset increases coverage for section 21, specifically "21.1 String
Objects".
* Add tests for "this" validation of String methods
* Add tests for ToNumber as used by String methods
* Add test for `length` prop of exotic String objs
* fixup! Add test for `length` prop of exotic String objs
Fixes gh-696
As pointed in gh-696, the ArrayBuffer ctor won't throw a RangeError when
invoked without arguments.
Instead of fixing the invalid assertion, this commit removes it as the
coverage for subclassing is already satisfied by the use of slice.
* Improve tests for GeneratorPrototype methods
- Assert return values more consistently
- Expand tests for constraints on `this` value
* Add more tests for dynamic GeneratorFunctions
* Add more tests for GenerationFunction.prototype
* Add more tests for the GeneratorFunction object
* Extend test: GeneratorFunction.prototype.prototype
* Improve precision of tests for generator methods
Extend existing assertions to explicitly verify that execution halts at
the intended location. Correct tests which were previously asserting
this behavior in contexts that did not match their name/description.
* Remove unused variables
* fixup! Improve tests for GeneratorPrototype methods
* fixup! Improve tests for GeneratorPrototype methods
* Add missing test for early error
* Add missing test for WithBaseObject
* Improve coverage for `new.target`
* Add test for deletion of SuperReference
* Add tests for `in` keyword restrictions
* fixup! Improve coverage for `new.target`
The global isNaN is not precise at all, and Number.isNaN is an ES6 feature that makes it preferrable to use assert's sameValue for NaN values, as it handles it internally using the comparison.
* Improve test coverage for `super` keyword
Add tests for SuperCall and SuperProperty, organized together in the
`test/language/expressions/super/` directory. For SuperProperty, include
tests for usage from within Object initializers and class bodies because
a different set of semantics are observable from each context.
Extend test for HTML comments
The V8 engine incorrectly requires a leading newline character for
MultiLineComments which contain the optional trailing HTMLCloseComment
[1]. Extend the current tests to fail when such an invalid restriction
is in place.
[1] https://bugs.chromium.org/p/v8/issues/detail?id=5142
A subtle aspect of the for-of iteration protocol concerns abrupt
completions that do *not* trigger iterator closing. Although this detail
is implicit in the current structure of the specification text, some
hosts may violate the protocol by closing the iterator because later
steps *do* specify that behavior.
The V8 engine is one such host--as of this writing, it incorrectly
closes the iterator when accessing the `value` property of the iterator
result produces an abrupt completion.
Add tests verifying that the iterator protocol is not violated in this
way for abrupt completions during the semantics of for-of evaluation.
ConversionError and RegExpError tests are methods that existed on
something that preceeded a IE9 Standard. They do not exist in the
specs, at least since ES5.
It's not test262 responsibility to maintain these tests as these
features can be freely implemented by any runtime.
These tests have been re-factored to expand coverage of the "default
parameter" language feature and to more closely adhere to this project's
preferred file organization.