@@ -35,7 +35,8 @@ const {
35
35
ObjectKeys,
36
36
ObjectPrototypeIsPrototypeOf,
37
37
ReflectApply,
38
- RegExpPrototypeTest,
38
+ RegExpPrototypeExec,
39
+ RegExpPrototypeSymbolReplace,
39
40
SafeMap,
40
41
String,
41
42
StringPrototypeCharCodeAt,
@@ -345,7 +346,7 @@ function getErrMessage(message, fn) {
345
346
// Always normalize indentation, otherwise the message could look weird.
346
347
if ( StringPrototypeIncludes ( message , '\n' ) ) {
347
348
if ( EOL === '\r\n' ) {
348
- message = StringPrototypeReplace ( message , / \r \n / g, '\n' ) ;
349
+ message = RegExpPrototypeSymbolReplace ( / \r \n / g, message , '\n' ) ;
349
350
}
350
351
const frames = StringPrototypeSplit ( message , '\n' ) ;
351
352
message = ArrayPrototypeShift ( frames ) ;
@@ -606,7 +607,7 @@ class Comparison {
606
607
if ( actual !== undefined &&
607
608
typeof actual [ key ] === 'string' &&
608
609
isRegExp ( obj [ key ] ) &&
609
- RegExpPrototypeTest ( obj [ key ] , actual [ key ] ) ) {
610
+ RegExpPrototypeExec ( obj [ key ] , actual [ key ] ) !== null ) {
610
611
this [ key ] = actual [ key ] ;
611
612
} else {
612
613
this [ key ] = obj [ key ] ;
@@ -652,7 +653,7 @@ function expectedException(actual, expected, message, fn) {
652
653
// Handle regular expressions.
653
654
if ( isRegExp ( expected ) ) {
654
655
const str = String ( actual ) ;
655
- if ( RegExpPrototypeTest ( expected , str ) )
656
+ if ( RegExpPrototypeExec ( expected , str ) !== null )
656
657
return ;
657
658
658
659
if ( ! message ) {
@@ -687,7 +688,7 @@ function expectedException(actual, expected, message, fn) {
687
688
for ( const key of keys ) {
688
689
if ( typeof actual [ key ] === 'string' &&
689
690
isRegExp ( expected [ key ] ) &&
690
- RegExpPrototypeTest ( expected [ key ] , actual [ key ] ) ) {
691
+ RegExpPrototypeExec ( expected [ key ] , actual [ key ] ) !== null ) {
691
692
continue ;
692
693
}
693
694
compareExceptionKey ( actual , expected , key , message , keys , fn ) ;
@@ -851,7 +852,7 @@ function hasMatchingError(actual, expected) {
851
852
if ( typeof expected !== 'function' ) {
852
853
if ( isRegExp ( expected ) ) {
853
854
const str = String ( actual ) ;
854
- return RegExpPrototypeTest ( expected , str ) ;
855
+ return RegExpPrototypeExec ( expected , str ) !== null ;
855
856
}
856
857
throw new ERR_INVALID_ARG_TYPE (
857
858
'expected' , [ 'Function' , 'RegExp' ] , expected
@@ -1000,7 +1001,7 @@ function internalMatch(string, regexp, message, fn) {
1000
1001
}
1001
1002
const match = fn === assert . match ;
1002
1003
if ( typeof string !== 'string' ||
1003
- RegExpPrototypeTest ( regexp , string ) !== match ) {
1004
+ RegExpPrototypeExec ( regexp , string ) !== null !== match ) {
1004
1005
if ( message instanceof Error ) {
1005
1006
throw message ;
1006
1007
}
0 commit comments