diff --git a/Makefile b/Makefile index f331214..f574a2c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: app libs +.PHONY: app libs test app_sources:= $(wildcard src/*/*.coffee) @@ -30,6 +30,9 @@ bootstrap: app cd vendor/bootstrap && make build cd vendor/bootstrap/bootstrap && tar cf - .| (cd ../../../app && tar xvf - ) +test: test/[0-9]*_mocha.coffee + ./node_modules/.bin/mocha -C --compilers coffee:coffee-script -u tdd $< + clean: rm -fr app - cd vendor/bootstrap && git reset --hard HEAD \ No newline at end of file + cd vendor/bootstrap && git reset --hard HEAD diff --git a/package.json b/package.json index 62e9e62..1c062ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Tumble", - "description": "An implementation of a parser for Tumbler." + "description": "An implementation of a parser for Tumbler.", "author": { "name": "Elf M. Sternberg" }, @@ -14,7 +14,9 @@ "coffee-script": "1.x.x" }, "devDependencies": { - "docco": "0.3.x" + "docco": "0.3.x", + "mocha": "1.8.x", + "chai": "1.5.x" }, "directories": { "lib": "./lib" diff --git a/test/01_basics_mocha.coffee b/test/01_basics_mocha.coffee new file mode 100644 index 0000000..843df2b --- /dev/null +++ b/test/01_basics_mocha.coffee @@ -0,0 +1,40 @@ +chai = require 'chai' +assert = chai.assert +expect = chai.expect +should = chai.should() + +tumbl = require 'lib/tumble' + +test_data = [ + { + 'input': '', + 'output': '' + } + { + 'input': '', + 'output': '', + } + { + 'input': '

{name}

' + 'output': '

Elf Sternberg

' + 'data': {'name': 'Elf Sternberg'} + } + + { + 'input': '

{title} {name}

' + 'output': '

Mr. Elf Sternberg

' + 'data': {'name': 'Elf Sternberg', 'title': 'Mr.'} + } + + + +describe "Foobar", -> + describe "#sayHello()", -> + it "should work with assert", -> + assert.equal foobar.sayHello(), "funky chicken!" + + it "should work with expect", -> + expect(foobar.sayHello()).to.equal "funky chicken!" + + it "should work with should", -> + foobar.sayHello().should.equal "funky chicken!"