cjohansen/Sinon.JS — pull request #103 by mantoni (2012-03-20 20:11:30+00:00)
Title: Support for fuzzy argument matching

A new namespace was introduced called sinon.match with this API:

- `any` matches anything
- `same(ref)` requires a value to strictly equal ref
- `typeOf(type)` requires a value to be of the given type, where type can be one of undefined, null, boolean, string, number, object, function, array, regexp or date
- `instanceOf(type)` requires a value to be an instance of the given type
- `re(expression)` requires a value to be of type string and match the given regular expression
- `like(object)` requires a value to be an object and have all properties as defined in the specified object - supports nested matchers

For convenience the following typeOf matchers are provided: bool, number, string, object, fund, array, regexp and date.

Custom matchers can be created like this:

```javascript
var trueIsh = sinon.match(function (value) {
return !!value;
}, 'trueIsh');
```

Return values are now using deep equals to align with argument checks. This allows to use matchers to verify return values: `spy.returned(sinon.match.string)`.

Note: To perform strict equal checks `sinon.match.same(ref)` has to be used. Therefore this change might break existing test cases.

Fixes issue #26