Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
47 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
lib/ | ||
test/test.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
dev: | ||
@test `which coffee` || echo 'You need to have CoffeeScript installed.' | ||
@coffee test/test.coffee | ||
|
||
release: | ||
@rm -fr lib/ | ||
@test `which coffee` || echo 'You need to have CoffeeScript installed.' | ||
@coffee -c -o lib src/*.coffee | ||
@coffee -c -o test test/test.coffee | ||
|
||
publish: dev | ||
publish: release | ||
@test `which npm` || echo 'You need to have npm installed.' | ||
npm publish | ||
@rm -fr lib/ | ||
|
||
test: dev | ||
test: release | ||
@test `which node` || echo 'You need to have node-js installed.' | ||
@node ./test/test.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
xml = '<root>' + | ||
'<xmlbuilder for="node-js">' + | ||
'<!-- CoffeeScript is awesome. -->' + | ||
'<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>' + | ||
'</xmlbuilder>' + | ||
'<test escaped="chars <>'"&">complete 100%</test>' + | ||
'<cdata><![CDATA[<test att="val">this is a test</test>]]></cdata>' + | ||
'</root>' | ||
|
||
builder = require '../src/index.coffee' | ||
builder.begin('root') | ||
.ele('xmlbuilder') | ||
.att('for', 'node-js') | ||
.com('CoffeeScript is awesome.') | ||
.ele('repo') | ||
.att('type', 'git') | ||
.txt('git://github.com/oozcitak/xmlbuilder-js.git') | ||
.up() | ||
.up() | ||
.ele('test') | ||
.att('escaped', 'chars <>\'"&') | ||
.txt('complete 100%') | ||
.up() | ||
.ele('cdata') | ||
.cdata('<test att="val">this is a test</test>') | ||
|
||
assert = require('assert') | ||
test = builder.toString() | ||
assert.strictEqual(xml, test) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,9 @@ | ||
var xml = '<root>' + | ||
'<xmlbuilder for="node-js">' + | ||
'<!-- CoffeeScript is awesome. -->' + | ||
'<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>' + | ||
'</xmlbuilder>' + | ||
'<test escaped="chars <>'"&">complete 100%</test>' + | ||
'<cdata><![CDATA[<test att="val">this is a test</test>]]></cdata>' + | ||
'</root>'; | ||
|
||
var builder = require('../lib/index.js'); | ||
builder.begin('root') | ||
.ele('xmlbuilder') | ||
.att('for', 'node-js') | ||
.com('CoffeeScript is awesome.') | ||
.ele('repo') | ||
.att('type', 'git') | ||
.txt('git://github.com/oozcitak/xmlbuilder-js.git') | ||
.up() | ||
.up() | ||
.ele('test') | ||
.att('escaped', 'chars <>\'"&') | ||
.txt('complete 100%') | ||
.up() | ||
.ele('cdata') | ||
.cdata('<test att="val">this is a test</test>'); | ||
|
||
var assert = require('assert'); | ||
var test = builder.toString(); | ||
assert.strictEqual(xml, test); | ||
|
||
(function() { | ||
var assert, builder, test, xml; | ||
xml = '<root>' + '<xmlbuilder for="node-js">' + '<!-- CoffeeScript is awesome. -->' + '<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>' + '</xmlbuilder>' + '<test escaped="chars <>'"&">complete 100%</test>' + '<cdata><![CDATA[<test att="val">this is a test</test>]]></cdata>' + '</root>'; | ||
builder = require('../src/index.coffee'); | ||
builder.begin('root').ele('xmlbuilder').att('for', 'node-js').com('CoffeeScript is awesome.').ele('repo').att('type', 'git').txt('git://github.com/oozcitak/xmlbuilder-js.git').up().up().ele('test').att('escaped', 'chars <>\'"&').txt('complete 100%').up().ele('cdata').cdata('<test att="val">this is a test</test>'); | ||
assert = require('assert'); | ||
test = builder.toString(); | ||
assert.strictEqual(xml, test); | ||
}).call(this); |