6 var should = require('../');
8 function test(name, fn){
12 console.log(' \x1b[31m%s', name);
13 console.log(' %s\x1b[0m', err.stack);
16 console.log(' √ \x1b[32m%s\x1b[0m', name);
19 function Point(x, y) {
22 this.sub = function(other){
31 test('new Point(x, y)', function(){
32 var point = new Point(50, 100);
33 point.should.be.an.instanceof(Point);
34 point.should.have.property('x', 50);
35 point.should.have.property('y', 100);
38 test('Point#sub()', function(){
39 var a = new Point(50, 100)
40 , b = new Point(20, 50);
41 a.sub(b).should.be.an.instanceof(Point);
42 a.sub(b).should.not.equal(a);
43 a.sub(b).should.not.equal(b);
44 a.sub(b).should.have.property('x', 30);
45 a.sub(b).should.have.property('y', 50);
48 test('Point#add()', function(){
49 var point = new Point(50, 100);
50 point.should.respondTo('add');