Sha256: 150abc35946bd2bfb5eaa4af29db81a91a5c4e6eff75c74251ae18cb6df24deb

Contents?: true

Size: 1.03 KB

Versions: 21

Compression:

Stored size: 1.03 KB

Contents

/**
 * Module dependencies.
 */

var should = require('../');

function test(name, fn){
  try {
    fn();
  } catch (err) {
    console.log('    \x1b[31m%s', name);
    console.log('    %s\x1b[0m', err.stack);
    return;
  }
  console.log('  √ \x1b[32m%s\x1b[0m', name);
}

function Point(x, y) {
  this.x = x;
  this.y = y;
  this.sub = function(other){
    return new Point(
        this.x - other.x
      , this.y - other.y);
  }
}

console.log();

test('new Point(x, y)', function(){
  var point = new Point(50, 100);
  point.should.be.an.instanceof(Point);
  point.should.have.property('x', 50);
  point.should.have.property('y', 100);
});

test('Point#sub()', function(){
  var a = new Point(50, 100)
    , b = new Point(20, 50);
  a.sub(b).should.be.an.instanceof(Point);
  a.sub(b).should.not.equal(a);
  a.sub(b).should.not.equal(b);
  a.sub(b).should.have.property('x', 30);
  a.sub(b).should.have.property('y', 50);
});

test('Point#add()', function(){
  var point = new Point(50, 100);
  point.should.respondTo('add');
});

console.log();

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
traceur-rb-0.0.1 vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js
stylus-source-0.29.0 vendor/node_modules/should/examples/runner.js
stylus-source-0.28.2 vendor/node_modules/should/examples/runner.js
stylus-source-0.28.1 vendor/node_modules/should/examples/runner.js
stylus-source-0.28.0 vendor/node_modules/should/examples/runner.js
stylus-source-0.27.2 vendor/node_modules/should/examples/runner.js
stylus-source-0.27.1 vendor/node_modules/should/examples/runner.js
stylus-source-0.27.0 vendor/node_modules/should/examples/runner.js
stylus-source-0.26.1 vendor/node_modules/should/examples/runner.js
stylus-source-0.26.0 vendor/node_modules/should/examples/runner.js
stylus-source-0.25.0 vendor/node_modules/should/examples/runner.js
vulcan-0.3.0 server/node_modules/express/node_modules/qs/support/should/examples/runner.js
vulcan-0.1.6 server/node_modules/express/node_modules/qs/support/should/examples/runner.js
vulcan-0.1.5 server/node_modules/express/node_modules/qs/support/should/examples/runner.js
vulcan-0.1.4 server/node_modules/express/node_modules/qs/support/should/examples/runner.js
vulcan-0.1.3 server/node_modules/express/node_modules/qs/support/should/examples/runner.js
vulcan-0.1.2 server/node_modules/express/node_modules/qs/support/should/examples/runner.js
vulcan-0.1.1 server/node_modules/express/node_modules/qs/support/should/examples/runner.js
vulcan-0.1.0 server/node_modules/express/node_modules/qs/support/should/examples/runner.js
vulcan-0.0.3 server/node_modules/express/node_modules/qs/support/should/examples/runner.js