* Add tests for early errors in functions
* Improve tests for class accessors
Use the `propertyHelper.js` utility in order to functionally test the
property descriptors of class methods.
* Remove redundant tests
The semantics of an IdentifierReference as a PropertyDefinition within
an object initializer are exhaustively tested by the files in this
directory whose name match the pattern `prop-def-id-*.js`.
Delete the redundant tests in favor of the more descriptively-named and
more exhaustive alternatives.
* Rename tests
* Update test names to be more descriptive
* Add tests for property descriptors of accessors
* Add tests for runtime error during method dfn
* Add test for observable iteration
* Extend tests for class "name" inference
Ensure that when a class defines a static "name" method, that method
definition prevents the "name" inference behavior.
* Re-generate tests
* Express JSON syntax tests with multiple assertions
When written with a single assertion, this test verifies only that "one
or more" of the Unicode points produces a SyntaxError. Re-factor the
test so that parsing behavior for each code point can be tested in
isolation.
* Re-introduce assertion
ECMAScript edition 2016 relies on the Unicode standard at version 8.0.0.
As part of a larger effort to update Test262 accordingly, the assertion
for the SyntaxError resulting from the use of the Mongolian Vowel
Separator (U+180E) was removed. However, ECMA-401 (The JSON Data
Interchange Format) continues to describe "insignificant whitespace" as
follows:
> Insignificant whitespace is allowed before or after any token.
> The whitespace characters are: character tabulation (U+0009),
> line feed (U+000A), carriage return (U+000D), and space
> (U+0020)
And because ECMA262 specifies step 2 of the `JSON.parse` algorithm as
follows:
> 2. Parse JText interpreted as UTF-16 encoded Unicode points (6.1.4) as
> a JSON text as specified in ECMA-404. Throw a SyntaxError exception
> if JText is not a valid JSON text as defined in that specification.
...the use of U+180E between JSON tokens should continue to produce a
SyntaxError, regardless of ECMA262's updated Unicode standard.
* fixup! Express JSON syntax tests with multiple assertions
This is a pure miscellaneous change to use global values of NaN and Infinity instead of their namespaced equivalents.
Ref 9ae0567a50 (r69049894)
cc @suwc
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.
This test was intended to assert the semantics of the `for-in`
statement, but it was mistakenly authored to use a `for-of` statement.
Update the statement under test, and improve the testing methodology to
correctly assert the creation of distinct bindings.
Ensure that early errors restricting labelled function declarations
within WithStatement and IfStatement are honored. Rename existing tests
to match the specification's spelling.
* 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.
The prior version of this test asserted only the property's
configurability. It was also limited to the RegExp object as returned
from the RegExp constructor.
Extend the test to verify all values of the property descriptor.
Duplicate these assertions in a separate file dedicated to the RegExp
object as created from a RegExp literal.
The previous commit removed two invalid tests designed to ensure that
the RegExpPrototype object is not itself a RegExp object. Introduce a
new test to assert this detail in a way that accounts for the
possibility of host extensions.
From ECMA262, section 16:
> Except as restricted in 16.2, an implementation may provide
> additional types, values, objects, properties, and functions beyond
> those described in this specification.
Section 16.2 makes no mention of the `lastIndex` property of the
%RegExpPrototype% intrinsic. It is therefor not a violation to define
%such an "own" property.
Remove the tests that assert otherwise.
A recent web-compatability change to ECMA262 modified the semantics of
the accessor methods on the %RegExpPrototype% intrinsic--the "get"
accessors now include steps dedicated to the case where the "this" value
is the %RegExpPrototype% object itself.
Remove the tests that have been invalidated by this change, introduce
tests asserting the new behavior, and extend coverage for other possible
"this" values.
The specification contains an explicit informative NOTE explaining that
the 'm' flag does not effect the behavior of the '^' assertion. Add a
test to verify this.
ES2015 reads:
> RegExpUnicodeEscapeSequence :: u{ HexDigits }
>
> - It is a Syntax Error if the MV of HexDigits > 1114111.
Use the MV 0x110000 to assert the lower boundary of values which are
expected to produce the SyntaxError.
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.