Previously, these tests simply compared against an equivalent regular expression pattern by generating a large string containing either all code points up to U+FFFF or U+10FFFF, depending on the `u` flag, and then performing:
str.replace(re, '') === str.replace(otherRe, '');
These two `String#replace` calls can be optimized into a single `RegExp#test` call by following the pattern used in the property escapes tests at https://github.com/mathiasbynens/unicode-property-escapes-tests.
As per spec changes (https://github.com/tc39/proposal-string-matchall/pull/35), removed tests related to the removed IsRegExp call.
To prevent older implementations (not observing spec change) from passing, added a new test to verify the reduced number of observable calls to IsRegExp.
Also fix a misreference in `features` frontmatter.
The RegExp named groups specification has changed to not throw
errors in certain cases. This patch updates the test262 tests to match
the new specification, and throws in an additional test that verifies
the interaction between named group syntax and other replacement.
The tests pass on a version of V8 which implements the new semantics.
92ceba518c
* Add tests for prototype realm inference
* Add tests for miscellaneous realm concerns
* Add tests for realm of spec-created Errors
In some cases, Error objects produced by the specification are
observable from ECMAScript code. Among these cases, some are further
differentiated in that they occur outside of any built-in function and
may be triggered through syntactic production directly. The current
realm record is commonly interpreted incorrectly under these
circumstances.
Add tests asserting that the expected realm record is used when
constructing such Error objects.
* Add tests for realm use in ArraySpeciesCreate
* Add tests for function realm retrieval
* Add tests for cross-realm behaviors of Symbols
* Add tests for GetValue and PutValue
* Add tests for realm of spec-created Arrays
In some cases, Arrays produced by CreateArrayFromList are observable
from ECMAScript code. Among these cases, two occur outside of any
built-in function and may be triggered through syntactic production
directly. The current realm record is commonly interpreted incorrectly
under these circumstances.
Add tests asserting that the expected realm record is used when
constructing arrays.
* Add test for spec-created object
* fixup! Add tests for realm of spec-created Errors
* fixup! Add tests for realm of spec-created Errors
* fixup! Add tests for prototype realm inference
* fixup! Add tests for miscellaneous realm concerns
* Tests for new lastIndex semantics
Add and update tests for the lastIndex semantic change introduced in
https://github.com/tc39/ecma262/pull/627.
* Address comments
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 RegExpBuiltinExec internal operation was modified in March of 2016
[1]: instead of referencing the `global` and `sticky` properties of the
"this" value, the algorithm now infers those values from the object's
[[OriginalFlags]] internal slot.
This change invalidated a number of tests. In cases where the change
resulted in an observable behavior, update the tests to assert the
latest specification text. In cases where the change removed a
previously-observable behavior, remove the files completely.
Specification text change set:
> 1. Assert: Type(_S_) is String.
> 1. Let _length_ be the number of code units in _S_.
> 1. Let _lastIndex_ be ? ToLength(? Get(_R_, `"lastIndex"`)).
> - 1. Let _global_ be ToBoolean(? Get(_R_, `"global"`)).
> - 1. Let _sticky_ be ToBoolean(? Get(_R_, `"sticky"`)).
> + 1. Let _flags_ be the value of _R_'s [[OriginalFlags]] internal slot.
> + 1. If _flags_ contains `"g"`, let _global_ be *true*, else let _global_ be *false*.
> + 1. If _flags_ contains `"y"`, let _sticky_ be *true*, else let _sticky_ be *false*.
> 1. If _global_ is *false* and _sticky_ is *false*, let _lastIndex_ be 0.
> 1. Let _matcher_ be the value of _R_'s [[RegExpMatcher]] internal slot.
> - 1. Let _flags_ be the value of _R_'s [[OriginalFlags]] internal slot.
> 1. If _flags_ contains `"u"`, let _fullUnicode_ be *true*, else let _fullUnicode_ be *false*.
> 1. Let _matchSucceeded_ be *false*.
> 1. Repeat, while _matchSucceeded_ is *false*
[1] https://github.com/tc39/ecma262/pull/494
This harness function is not necessary in the majority of cases in which
it is used. Remove its usage to simplify tests and decrease the amount
of domain-specific knowledge necessary to contribute to the test suite.
Persist the harness function itself for use by future tests for ES2015
modules (such a helper is necessary for tests that are interpreted as
module code).