UNPKG

4.5

Version:

Monadic test assertions

21 lines 511 B
import { inspect } from '../helpers'; export function throws(f) { return new Throws(f); } var Throws = (function () { function Throws(f) { this.f = f; } Throws.prototype.verify = function (verification) { var f = this.f; try { var x = f(); verification.failure("Did not throw, returned: " + inspect(x)); } catch (e) { verification.success(e); } }; return Throws; }()); //# sourceMappingURL=throws.js.map