20 lines
546 B
JavaScript
20 lines
546 B
JavaScript
getJasmineRequireObj().StringMatching = function(j$) {
|
|
function StringMatching(expected) {
|
|
if (!j$.private.isString(expected) && !j$.private.isA('RegExp', expected)) {
|
|
throw new Error('Expected is not a String or a RegExp');
|
|
}
|
|
|
|
this.regexp = new RegExp(expected);
|
|
}
|
|
|
|
StringMatching.prototype.asymmetricMatch = function(other) {
|
|
return this.regexp.test(other);
|
|
};
|
|
|
|
StringMatching.prototype.jasmineToString = function() {
|
|
return '<jasmine.stringMatching(' + this.regexp + ')>';
|
|
};
|
|
|
|
return StringMatching;
|
|
};
|