Basic tests.
This commit is contained in:
parent
04de588943
commit
92680574f3
7
Makefile
7
Makefile
|
@ -1,4 +1,4 @@
|
||||||
.PHONY: app libs
|
.PHONY: app libs test
|
||||||
|
|
||||||
|
|
||||||
app_sources:= $(wildcard src/*/*.coffee)
|
app_sources:= $(wildcard src/*/*.coffee)
|
||||||
|
@ -30,6 +30,9 @@ bootstrap: app
|
||||||
cd vendor/bootstrap && make build
|
cd vendor/bootstrap && make build
|
||||||
cd vendor/bootstrap/bootstrap && tar cf - .| (cd ../../../app && tar xvf - )
|
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:
|
clean:
|
||||||
rm -fr app
|
rm -fr app
|
||||||
cd vendor/bootstrap && git reset --hard HEAD
|
cd vendor/bootstrap && git reset --hard HEAD
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Tumble",
|
"name": "Tumble",
|
||||||
"description": "An implementation of a parser for Tumbler."
|
"description": "An implementation of a parser for Tumbler.",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Elf M. Sternberg"
|
"name": "Elf M. Sternberg"
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,9 @@
|
||||||
"coffee-script": "1.x.x"
|
"coffee-script": "1.x.x"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"docco": "0.3.x"
|
"docco": "0.3.x",
|
||||||
|
"mocha": "1.8.x",
|
||||||
|
"chai": "1.5.x"
|
||||||
},
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "./lib"
|
"lib": "./lib"
|
||||||
|
|
|
@ -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': '<html>',
|
||||||
|
'output': '<html>',
|
||||||
|
}
|
||||||
|
{
|
||||||
|
'input': '<h1>{name}</h1>'
|
||||||
|
'output': '<h1>Elf Sternberg</h1>'
|
||||||
|
'data': {'name': 'Elf Sternberg'}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
'input': '<h1>{title} {name}</h1>'
|
||||||
|
'output': '<h1>Mr. Elf Sternberg</h1>'
|
||||||
|
'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!"
|
Loading…
Reference in New Issue