mirror of
https://github.com/seejohnrun/haste-server
synced 2025-07-14 17:13:45 -07:00
Added node modules
This commit is contained in:
parent
ca9d4c18f7
commit
d1e0644a4e
575 changed files with 77900 additions and 6 deletions
53
node_modules/should/examples/runner.js
generated
vendored
Normal file
53
node_modules/should/examples/runner.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
|
||||
/**
|
||||
* 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();
|
Loading…
Add table
Add a link
Reference in a new issue