Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, function (y){
Z.equals(x, y) ? res() : rej(new AssertionError({
expected: x,
actual: y,
message: 'Expected the Future to resolve with ' + show(x) + '; got: ' + show(y)
}));
});
});
export var eq = function eq (actual, expected){
strictEqual(arguments.length, eq.length);
strictEqual(show(actual), show(expected));
strictEqual(Z.equals(actual, expected), true);
};
function eq(actual, expected) {
assert.strictEqual (arguments.length, eq.length);
assert.strictEqual (Z.toString (actual), Z.toString (expected));
assert.strictEqual (Z.equals (actual, expected), true);
}
function eq(actual, expected) {
assert.strictEqual (arguments.length, eq.length);
assert.strictEqual (Z.toString (actual), Z.toString (expected));
assert.strictEqual (Z.equals (actual, expected), true);
}
export var assertEqual = function (a, b){
var states = ['pending', 'rejected', 'resolved'];
if(!(a instanceof Future && b instanceof Future)){ throw new Error('Both values must be Futures') }
var astate = 0, aval;
var bstate = 0, bval;
a._interpret(throwit, function (x){astate = 1; aval = x}, function (x){astate = 2; aval = x});
b._interpret(throwit, function (x){bstate = 1; bval = x}, function (x){bstate = 2; bval = x});
if(astate === 0){ throw new Error('First Future passed to assertEqual did not resolve instantly') }
if(bstate === 0){ throw new Error('Second Future passed to assertEqual did not resolve instantly') }
if(isFuture(aval) && isFuture(bval)) return assertEqual(aval, bval);
if(astate === bstate && Z.equals(aval, bval)){ return true }
throw new Error(
'\n ' + (a.toString()) +
' :: Future({ <' + states[astate] + '> ' + show(aval) + ' })' +
'\n does not equal:\n ' + b.toString() +
' :: Future({ <' + states[bstate] + '> ' + show(bval) + ' })\n '
);
};
transitivity: assert.forall3 (function(a, b, c) {
return Z.Setoid.test (a) &&
Z.Setoid.test (b) &&
Z.Setoid.test (c) &&
(Z.equals (a, b) && Z.equals (b, c) ? Z.equals (a, c) : true);
})
symmetry: assert.forall2 (function(a, b) {
return Z.Setoid.test (a) &&
Z.Setoid.test (b) &&
Z.equals (a, b) === Z.equals (b, a);
}),
reflexivity: assert.forall1 (function(a) {
return Z.Setoid.test (a) &&
Z.equals (a, a);
}),