Files
jasmine/src/core/asymmetric_equality/StringMatching.js
2025-09-27 13:21:09 -07:00

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;
};