Skip to content
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

Port Test262’s RegExp lookbehind tests #37928

Merged

Conversation

mathiasbynens
Copy link
Contributor

@mathiasbynens mathiasbynens commented Jan 13, 2023

This patch ports the tests from https://github.com/tc39/test262/tree/main/test/built-ins/RegExp/lookBehind into WPT.

Any uses of the following Test262 harness APIs have been replaced with the corresponding WPT testharness.js API:

  • assert.compareArrayassert_array_equals
  • assert.sameValueassert_equals

The tests pass in Chrome and Firefox.

This is motivated by the proposal to include RegExp lookbehind functionality in Interop 2023, which would require WPT coverage since Test262 results cannot yet be consumed / reported by the wpt.fyi & Interop dashboards.

@wpt-pr-bot
Copy link
Collaborator

There are no reviewers for this pull request. Please reach out on the chat room to get help with this. Thank you!

@mathiasbynens
Copy link
Contributor Author

mathiasbynens commented Jan 13, 2023

Question to reviewers: stable Safari doesn’t yet support lookbehinds, and throws an early parse error when it encounters the first lookbehind in JS source. As a result, the test harness report page remains blank. Is this acceptable to convey the “fail” state?

(If we wanted the harness to show up, we’d have to turn all RegExp literals using lookbehinds into a string literal passed to the RegExp() constructor within a try-catch, with the catch handling the case of no parsing support.)

This patch ports the tests from [1] into WPT.

Any uses of the following Test262 harness APIs have been replaced with the corresponding WPT testharness.js API:

- `assert.compareArray` → `assert_array_equals`
- `assert.sameValue` → `assert_equals`

The tests pass in Chrome and Firefox.

[1]: https://github.com/tc39/test262/tree/main/test/built-ins/RegExp/lookBehind
Copy link
Contributor

@jgraham jgraham left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

@foolip
Copy link
Member

foolip commented Jan 16, 2023

Question to reviewers: stable Safari doesn’t yet support lookbehinds, and throws an early parse error when it encounters the first lookbehind in JS source. As a result, the test harness report page remains blank. Is this acceptable to convey the “fail” state?

Since it's already fixed in STP I think that's OK, yeah. It's certainly not the best failure more, but good enough for something that's being fixed.

@foolip foolip merged commit 34faeb4 into web-platform-tests:master Jan 16, 2023
@mathiasbynens mathiasbynens deleted the javascript-regexp-lookbehind branch January 16, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants