How to use the sanctuary-type-classes.equals function in sanctuary-type-classes

To help you get started, we’ve selected a few sanctuary-type-classes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fluture-js / Fluture / test / util.js View on Github external
}, 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)
      }));
    });
  });
github fluture-js / Fluture / test / util.js View on Github external
export var eq = function eq (actual, expected){
  strictEqual(arguments.length, eq.length);
  strictEqual(show(actual), show(expected));
  strictEqual(Z.equals(actual, expected), true);
};
github Avaq / permissionary / test / index.js View on Github external
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);
}
github fluture-js / fluture-express / test / index.js View on Github external
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);
}
github fluture-js / Fluture / test / util.js View on Github external
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  '
  );
};
github fantasyland / fantasy-laws / src / Setoid.js View on Github external
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);
  })
github fantasyland / fantasy-laws / src / Setoid.js View on Github external
symmetry: assert.forall2 (function(a, b) {
    return Z.Setoid.test (a) &&
           Z.Setoid.test (b) &&
           Z.equals (a, b) === Z.equals (b, a);
  }),
github fantasyland / fantasy-laws / src / Setoid.js View on Github external
reflexivity: assert.forall1 (function(a) {
    return Z.Setoid.test (a) &&
           Z.equals (a, a);
  }),