@@ -13,7 +13,7 @@ var forEach = require('for-each');
13
13
var inspect = require ( 'object-inspect' ) ;
14
14
var isEnumerable = callBound ( 'Object.prototype.propertyIsEnumerable' ) ;
15
15
var toLowerCase = callBound ( 'String.prototype.toLowerCase' ) ;
16
- var $test = callBound ( 'RegExp.prototype.test ' ) ;
16
+ var $exec = callBound ( 'RegExp.prototype.exec ' ) ;
17
17
var objectToString = callBound ( 'Object.prototype.toString' ) ;
18
18
19
19
module . exports = Test ;
@@ -553,7 +553,7 @@ Test.prototype['throws'] = function (fn, expected, msg, extra) {
553
553
var passed = caught ;
554
554
555
555
if ( isRegExp ( expected ) ) {
556
- passed = $test ( expected , caught && caught . error ) ;
556
+ passed = $exec ( expected , caught && caught . error ) !== null ;
557
557
expected = String ( expected ) ;
558
558
}
559
559
@@ -610,7 +610,7 @@ Test.prototype.match = function match(string, regexp, msg, extra) {
610
610
extra : extra
611
611
} ) ;
612
612
} else {
613
- var matches = $test ( regexp , string ) ;
613
+ var matches = $exec ( regexp , string ) !== null ;
614
614
var message = defined (
615
615
msg ,
616
616
'The input ' + ( matches ? 'matched' : 'did not match' ) + ' the regular expression ' + inspect ( regexp ) + '. Input: ' + inspect ( string )
@@ -643,7 +643,7 @@ Test.prototype.doesNotMatch = function doesNotMatch(string, regexp, msg, extra)
643
643
extra : extra
644
644
} ) ;
645
645
} else {
646
- var matches = $test ( regexp , string ) ;
646
+ var matches = $exec ( regexp , string ) !== null ;
647
647
var message = defined (
648
648
msg ,
649
649
'The input ' + ( matches ? 'was expected to not match' : 'did not match' ) + ' the regular expression ' + inspect ( regexp ) + '. Input: ' + inspect ( string )
0 commit comments