Skip to content

Commit e34bf20

Browse files
committed
Test that RegExpIdentifierName characters are allowed
1 parent a6e305a commit e34bf20

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/spec/s-xregexp.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,21 +393,20 @@ describe('XRegExp()', function() {
393393
// Named capture *functionality* is tested by the specs for named backreference syntax,
394394
// XRegExp.exec, XRegExp.replace, etc.
395395

396-
it('should allow the characters A-Z, a-z, 0-9, $, and _ to be used in capture names', function() {
396+
it('should allow the characters A-Z, a-z, 0-9, $, _, and RegExpIdentifierName characters to be used in capture names', function() {
397397
expect(XRegExp('(?<Az>x)').test('x')).toBe(true);
398398
expect(XRegExp('(?<_09>x)').test('x')).toBe(true);
399399
expect(XRegExp('(?<$>x)').test('x')).toBe(true);
400+
expect(function() {XRegExp('(?<naïve>)');}).not.toThrow();
401+
expect(function() {XRegExp('(?<Русский>)');}).not.toThrow();
402+
expect(function() {XRegExp('(?<日本語>)');}).not.toThrow();
400403
});
401404

402405
it('should throw an exception if characters other than A-Z, a-z, 0-9, $, and _ are used in capture names', function() {
403406
expect(function() {XRegExp('(?<?>)');}).toThrowError(SyntaxError);
404407
expect(function() {XRegExp('(?<.>)');}).toThrowError(SyntaxError);
405408
expect(function() {XRegExp('(?<<>)');}).toThrowError(SyntaxError);
406409
expect(function() {XRegExp('(?<->)');}).toThrowError(SyntaxError);
407-
// Native named capture uses different allowed chars that XRegExp should be updated to handle
408-
//expect(function() {XRegExp('(?<naïve>)');}).toThrowError(SyntaxError);
409-
//expect(function() {XRegExp('(?<Русский>)');}).toThrowError(SyntaxError);
410-
//expect(function() {XRegExp('(?<日本語>)');}).toThrowError(SyntaxError);
411410
});
412411

413412
it('should not allow capture names to start with digits', function() {

0 commit comments

Comments
 (0)