@@ -1257,13 +1257,13 @@ describe('XRegExp.replace()', function() {
1257
1257
} ) ;
1258
1258
1259
1259
it ( 'should throw an exception for backreferences to unknown group names' , function ( ) {
1260
- expect ( function ( ) { XRegExp . replace ( 'test' , XRegExp ( '(?<test>t)' , 'g ') , ':${x}:' ) ; } ) . toThrowError ( SyntaxError ) ;
1261
- expect ( function ( ) { XRegExp . replace ( 'test' , XRegExp ( '(?<test>t)' , 'g ') , ':$<x>:' ) ; } ) . toThrowError ( SyntaxError ) ;
1260
+ expect ( function ( ) { XRegExp . replace ( 'test' , XRegExp ( '(?<test>) ' ) , ':${x}:' ) ; } ) . toThrowError ( SyntaxError ) ;
1261
+ expect ( function ( ) { XRegExp . replace ( 'test' , XRegExp ( '(?<test>) ' ) , ':$<x>:' ) ; } ) . toThrowError ( SyntaxError ) ;
1262
1262
} ) ;
1263
1263
1264
1264
it ( 'should throw an exception for backreferences with leading or trailing spaces' , function ( ) {
1265
- expect ( function ( ) { XRegExp . replace ( 'test' , / ( ?<test > ) / , '$< test>' ) ; } ) . toThrowError ( SyntaxError ) ;
1266
- expect ( function ( ) { XRegExp . replace ( 'test' , / ( ?<test > ) / , '$<test >' ) ; } ) . toThrowError ( SyntaxError ) ;
1265
+ expect ( function ( ) { XRegExp . replace ( 'test' , XRegExp ( '( ?<test>)' ) , '$< test>' ) ; } ) . toThrowError ( SyntaxError ) ;
1266
+ expect ( function ( ) { XRegExp . replace ( 'test' , XRegExp ( '( ?<test>)' ) , '$<test >' ) ; } ) . toThrowError ( SyntaxError ) ;
1267
1267
} ) ;
1268
1268
1269
1269
} ) ;
@@ -1310,8 +1310,8 @@ describe('XRegExp.replace()', function() {
1310
1310
1311
1311
it ( 'should throw an exception for backreferences to unknown group numbers when using named capture' , function ( ) {
1312
1312
expect ( function ( ) { XRegExp . replace ( 'test' , XRegExp ( '(?<n>t)' ) , '$<2>' ) ; } ) . toThrowError ( SyntaxError ) ;
1313
- // Native named capture introduced in ES2018
1314
- expect ( function ( ) { XRegExp . replace ( 'test' , / (?< n > t ) / , '$<2>' ) ; } ) . toThrowError ( SyntaxError ) ;
1313
+ // Native ES2018 named capture
1314
+ // expect(function() {XRegExp.replace('test', /(?<n>t)/, '$<2>');}).toThrowError(SyntaxError);
1315
1315
} ) ;
1316
1316
1317
1317
it ( 'should throw an exception for backreferences with leading or trailing spaces' , function ( ) {
@@ -1370,8 +1370,8 @@ describe('XRegExp.replace()', function() {
1370
1370
1371
1371
it ( 'should throw an exception for backreferences to unknown group numbers when using named capture' , function ( ) {
1372
1372
expect ( function ( ) { XRegExp . replace ( 'test' , XRegExp ( '(?<n>t)' ) , '$2' ) ; } ) . toThrowError ( SyntaxError ) ;
1373
- // Native named capture introduced in ES2018
1374
- expect ( function ( ) { XRegExp . replace ( 'test' , / (?< n > t ) / , '$2' ) ; } ) . toThrowError ( SyntaxError ) ;
1373
+ // Native ES2018 named capture
1374
+ // expect(function() {XRegExp.replace('test', /(?<n>t)/, '$2');}).toThrowError(SyntaxError);
1375
1375
} ) ;
1376
1376
1377
1377
it ( 'should throw an exception for unrecognized tokens' , function ( ) {
0 commit comments