Skip to content

Add RegExp source escaping tests for remaining LineTerminators (CR, LS, PS)#4958

Open
dmvjs wants to merge 1 commit intotc39:mainfrom
dmvjs:add/regexp-source-line-terminators
Open

Add RegExp source escaping tests for remaining LineTerminators (CR, LS, PS)#4958
dmvjs wants to merge 1 commit intotc39:mainfrom
dmvjs:add/regexp-source-line-terminators

Conversation

@dmvjs
Copy link
Contributor

@dmvjs dmvjs commented Feb 27, 2026

Adds canonical roundtrip tests for the three LineTerminators not yet covered in test/built-ins/RegExp/prototype/source/:

  • U+000D Carriage Return (value-carriage-return.js)
  • U+2028 Line Separator (value-line-separator.js)
  • U+2029 Paragraph Separator (value-paragraph-separator.js)

Each test follows the same pattern as the existing value-line-terminator.js: construct a RegExp containing the character, round-trip its .source through eval, and assert behavioral equivalence.

Closes #97.

…S, PS)

Covers the three LineTerminators not yet tested in canonical form:
- U+000D CARRIAGE RETURN
- U+2028 LINE SEPARATOR
- U+2029 PARAGRAPH SEPARATOR

Each test verifies that EscapeRegExpPattern produces a source value that
round-trips through eval to a behaviorally equivalent RegExp, per
sec-get-regexp.prototype.source.

Addresses tc39#97.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dmvjs dmvjs requested a review from a team as a code owner February 27, 2026 18:39
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.

Coverage for invalid RegExp source

2 participants