Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vpzomtrrfrt committed Sep 26, 2015
1 parent 3a1d3a7 commit abc6dc5
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 3 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 1,10 @@
{
"name": "djs-dson",
"version": "0.0.0",
"version": "0.0.1",
"description": "DSON implementation in Dogescript",
"devDependencies": {
"dogescript": "^2.3.0"
"dogescript": "^2.3.0",
"mocha": "^2.3.3"
},
"repository": {
"type": "git",
Expand All @@ -12,7 13,8 @@
"homepage": "https://github.com/vpzomtrfrt/DSON",
"author": "VpzomTrrfrt",
"scripts": {
"prepublish": "node_modules/dogescript/bin/dogescript.js DSON.djs > DSON.js"
"prepublish": "node_modules/dogescript/bin/dogescript.js DSON.djs > DSON.js",
"test": "node_modules/dogescript/bin/dogescript.js test/test.djs > test/test.js; node_modules/mocha/bin/mocha"
},
"main": "DSON.js"
}
60 changes: 60 additions & 0 deletions test/test.djs
Original file line number Diff line number Diff line change
@@ -0,0 1,60 @@
so assert
so ../DSON as DSON
plz describe with 'DSON', much
plz describe with 'dogeify', much
plz it with 'Number' much
assert.equal('41', DSON.dogeify(33))
assert.equal('1', DSON.dogeify(1))
wow&
plz it with 'String' much
assert.equal('"pop"', DSON.dogeify('pop'))
assert.equal('"a test"', DSON.dogeify('a test'))
wow&
plz it with 'Object' much
assert.equal('such "foo" is "bar", "pop" is "corn", "cat" is "not a doge" wow', DSON.dogeify({'foo': 'bar', 'pop': 'corn', 'cat': 'not a doge'}))
assert.equal('such "num" is 1, "str" is "hi", "bool" is yes wow', DSON.dogeify({'num': 1, 'str': 'hi', 'bool': true}))
wow&
plz it with 'Array' much
assert.equal('so 0 also 1 and 2 many', DSON.dogeify([0,1,2]))
assert.equal('so "hi" and "there" many', DSON.dogeify(['hi', 'there']))
wow&
plz it with 'Boolean' much
assert.equal('yes', DSON.dogeify(true))
assert.equal('no', DSON.dogeify(false))
wow&
plz it with 'Nested object' much
assert.equal('such "obj" is such "foo" is "bar", "cat" is "not a doge" wow wow', DSON.dogeify({obj: {'foo': 'bar', 'cat': 'not a doge'}}))
wow&
plz it with 'Nested array' much
assert.equal('so so "THIS" also "IS" and "DOGESCRIPT" many and so 0 also 1 and 2 many many', DSON.dogeify([['THIS', 'IS', 'DOGESCRIPT'], [0,1,2]]))
wow&
wow&
plz describe with 'parse', much
plz it with 'Number' much
assert.equal(DSON.parse('41'), 33)
assert.equal(DSON.parse('1'), 1)
wow&
plz it with 'String' much
assert.equal(DSON.parse('"pop"'), 'pop')
assert.equal(DSON.parse('"a test"'), 'a test')
wow&
plz it with 'Object' much
assert.deepEqual(DSON.parse('such "foo" is "bar", "pop" is "corn", "cat" is "not a doge" wow'), {'foo': 'bar', 'pop': 'corn', 'cat': 'not a doge'})
assert.deepEqual(DSON.parse('such "num" is 1, "str" is "hi", "bool" is yes wow'), {'num': 1, 'str': 'hi', 'bool': true})
wow&
plz it with 'Array' much
assert.deepEqual(DSON.parse('so 0 also 1 and 2 many'), [0,1,2])
assert.deepEqual(DSON.parse('so "hi" and "there" many'), ['hi', 'there'])
wow&
plz it with 'Boolean' much
assert.equal(DSON.parse('yes'), true)
assert.equal(DSON.parse('no'), false)
wow&
plz it with 'Nested object' much
assert.deepEqual(DSON.parse('such "obj" is such "foo" is "bar", "cat" is "not a doge" wow wow'), {obj: {'foo': 'bar', 'cat': 'not a doge'}})
wow&
plz it with 'Nested array' much
assert.deepEqual(DSON.parse('so so "THIS" also "IS" and "DOGESCRIPT" many and so 0 also 1 and 2 many many'), [['THIS', 'IS', 'DOGESCRIPT'], [0,1,2]])
wow&
wow&
wow&

0 comments on commit abc6dc5

Please sign in to comment.