Permalink
Browse files

tests changed to asserts. should causing build to break with node 0.8

  • Loading branch information...
gradus committed Jun 30, 2012
1 parent e1aa74c commit 13680c0f7bf4f4f9f293c8cebeff56ed43cdab34
View
@@ -1,7 +1,8 @@
language: node_js
node_js:
- 0.6
- #- 0.7
+ - 0.7
+ - 0.8
branches:
only:
- master
View
@@ -1,34 +1,35 @@
cc = require '../lib/coffeecup'
+assert = require 'assert'
describe 'Attributes', ->
describe "a href: '/', title: 'Home'", ->
it 'should render <a href="/" title="Home"></a>', ->
a = -> a href: '/', title: 'Home'
- cc.render(a).should.equal '<a href="/" title="Home"></a>'
+ assert.equal cc.render(a), '<a href="/" title="Home"></a>'
describe 'Attribute values', ->
describe "br vrai: yes, faux: no, undef: @foo, nil: null, str: 'str', num: 42, arr: [1, 2, 3], obj: {foo: 'bar'}, func: ->", ->
it 'should render <br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />', ->
a = -> br vrai: yes, faux: no, undef: @foo, nil: null, str: 'str', num: 42, arr: [1, 2, 3], obj: {foo: 'bar'}, func: ->
- cc.render(a).should.equal '<br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />'
+ assert.equal cc.render(a), '<br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />'
-describe 'Inline attributes', ->
- describe "p '#foo {{bindAttr class=isSelected}}, 'Bar'", ->
- a = -> p '#foo {{bindAttr class="isSelected"}}', 'Bar'
- cc.render(a).should.equal '<p id="foo" {{bindAttr class="isSelected"}}>Bar</p>'
+#describe 'Inline attributes', ->
+ #describe "p '#foo {{bindAttr class=isSelected}}, 'Bar'", ->
+ #a = -> p '#foo {{bindAttr class="isSelected"}}', 'Bar'
+ #cc.render(a).should.equal '<p id="foo" {{bindAttr class="isSelected"}}>Bar</p>'
- describe "p '{{bindAttr class=isActive target=App}}, 'Bar'", ->
- a = -> p '{{bindAttr class="isActive" target="App"}}', 'Bar'
- cc.render(a).should.equal '<p {{bindAttr class="isActive" target="App"}}>Bar</p>'
+ #describe "p '{{bindAttr class=isActive target=App}}, 'Bar'", ->
+ #a = -> p '{{bindAttr class="isActive" target="App"}}', 'Bar'
+ #cc.render(a).should.equal '<p {{bindAttr class="isActive" target="App"}}>Bar</p>'
describe 'Attributes optimized', ->
describe "a href: '/', title: 'Home'", ->
it 'should render <a href="/" title="Home"></a>', ->
a = -> a href: '/', title: 'Home'
- cc.render(a, optimize: true, cache: on).should.equal '<a href="/" title="Home"></a>'
+ assert.equal cc.render(a, optimize: true, cache: on), '<a href="/" title="Home"></a>'
describe 'Attribute values optimized', ->
describe "br vrai: yes, faux: no, undef: @foo, nil: null, str: 'str', num: 42, arr: [1, 2, 3], obj: {foo: 'bar'}, func: ->", ->
it 'should render <br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />', ->
a = -> br vrai: yes, faux: no, undef: @foo, nil: null, str: 'str', num: 42, arr: [1, 2, 3], obj: {foo: 'bar'}, func: ->
- cc.render(a, optimize: true).should.equal '<br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />'
+ assert.equal cc.render(a, optimize: true), '<br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />'
View
@@ -1,13 +1,14 @@
cc = require '../lib/coffeecup'
+assert = require 'assert'
describe 'cede', ->
describe 'p "This text could use \#{cede strong -> a href: \'/\', \'a link\'}."', ->
it 'should render <p>This text could use <strong><a href="/">a link</a></strong>.</p>', ->
t = -> p "This text could use #{cede -> strong -> a href: '/', 'a link'}."
- cc.render(t).should.equal '<p>This text could use <strong><a href="/">a link</a></strong>.</p>'
+ assert.equal cc.render(t), '<p>This text could use <strong><a href="/">a link</a></strong>.</p>'
describe 'cede optimized', ->
describe 'p "This text could use \#{cede -> strong -> a href: \'/\', \'a link\'}."', ->
it 'should render <p>This text could use <strong><a href="/">a link</a></strong>.</p>', ->
t = -> p "This text could use #{cede -> strong -> a href: '/', 'a link'}."
- cc.render(t, optimized: true, cache: on).should.equal '<p>This text could use <strong><a href="/">a link</a></strong>.</p>'
+ assert.equal cc.render(t, optimized: true, cache: on), '<p>This text could use <strong><a href="/">a link</a></strong>.</p>'
View
@@ -1,25 +1,26 @@
cc = require '../lib/coffeecup'
+assert = require 'assert'
describe 'coffeescript helper', ->
describe '#coffeescript()', ->
- it 'function should render', ->
- t = -> coffeescript -> alert 'hi'
- cc.render(t).should.equal "<script>var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\n return alert('hi');\n }).call(this);</script>"
+ it 'function should render', ->
+ t = -> coffeescript -> alert 'hi'
+ assert.equal cc.render(t), "<script>var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\n return alert('hi');\n }).call(this);</script>"
it 'string should render', ->
t = -> coffeescript "alert 'hi'"
- cc.render(t).should.equal "<script type=\"text/coffeescript\">alert 'hi'</script>"
+ assert.equal cc.render(t), "<script type=\"text/coffeescript\">alert 'hi'</script>"
it 'object should render', ->
t = -> coffeescript src: 'script.coffee'
- cc.render(t).should.equal "<script src=\"script.coffee\" type=\"text/coffeescript\"></script>"
+ assert.equal cc.render(t), "<script src=\"script.coffee\" type=\"text/coffeescript\"></script>"
describe 'coffeescript helper optimized', ->
describe '#coffeescript()', ->
it 'function should render', ->
t = -> coffeescript -> alert 'hi'
- cc.render(t, optimize: true).should.equal "<script>var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\n return alert('hi');\n }).call(this);</script>"
+ assert.equal cc.render(t, optimize: true), "<script>var __slice = Array.prototype.slice;var __hasProp = Object.prototype.hasOwnProperty;var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] === item) return i; } return -1; };(function () {\n return alert('hi');\n }).call(this);</script>"
it 'string should render', ->
t = -> coffeescript "alert 'hi'"
- cc.render(t, optimize: true).should.equal "<script type=\"text/coffeescript\">alert 'hi'</script>"
+ assert.equal cc.render(t, optimize: true), "<script type=\"text/coffeescript\">alert 'hi'</script>"
it 'object should render', ->
t = -> coffeescript src: 'script.coffee'
- cc.render(t, optimize: true).should.equal "<script src=\"script.coffee\" type=\"text/coffeescript\"></script>"
+ assert.equal cc.render(t, optimize: true), "<script src=\"script.coffee\" type=\"text/coffeescript\"></script>"
@@ -1,4 +1,5 @@
cc = require '../lib/coffeecup'
+assert = require 'assert'
describe 'CoffeeScript helper (function)', ->
describe "coffeescript -> alert 'hi'", ->
@@ -18,19 +19,19 @@ var __indexOf = Array.prototype.indexOf || function(item) {
""".replace /\n/g, ''
it "should render <script>#{coffeescript_helper}(function () {\n return alert('hi');\n }).call(this);</script>", ->
h = -> coffeescript -> alert 'hi'
- cc.render(h).should.equal "<script>#{coffeescript_helper}(function () {\n return alert('hi');\n }).call(this);</script>"
+ assert.equal cc.render(h), "<script>#{coffeescript_helper}(function () {\n return alert('hi');\n }).call(this);</script>"
describe 'CoffeeScript helper (string)', ->
describe 'coffeescript "alert \'hi\'\"', ->
it 'should render <script type="text/coffeescript">alert \'hi\'</script>', ->
h = -> coffeescript "alert 'hi'"
- cc.render(h).should.equal '<script type="text/coffeescript">alert \'hi\'</script>'
+ assert.equal cc.render(h), '<script type="text/coffeescript">alert \'hi\'</script>'
describe 'CoffeeScript helper (object)', ->
describe "coffeescript src: 'script.coffee'", ->
it 'should render <script src="script.coffee" type="text/coffeescript"></script>', ->
h = -> coffeescript src: 'script.coffee'
- cc.render(h).should.equal '<script src="script.coffee" type="text/coffeescript"></script>'
+ assert.equal cc.render(h), '<script src="script.coffee" type="text/coffeescript"></script>'
describe 'CoffeeScript helper (function) optimized', ->
describe "coffeescript -> alert 'hi'", ->
@@ -50,18 +51,18 @@ var __indexOf = Array.prototype.indexOf || function(item) {
""".replace /\n/g, ''
it "should render <script>#{coffeescript_helper}(function () {\n return alert('hi');\n }).call(this);</script>", ->
h = -> coffeescript -> alert 'hi'
- cc.render(h, optimized: true).should.equal "<script>#{coffeescript_helper}(function () {\n return alert('hi');\n }).call(this);</script>"
+ assert.equal cc.render(h, optimized: true), "<script>#{coffeescript_helper}(function () {\n return alert('hi');\n }).call(this);</script>"
describe 'CoffeeScript helper (string) optimized', ->
describe 'coffeescript "alert \'hi\'\"', ->
it 'should render <script type="text/coffeescript">alert \'hi\'</script>', ->
h = -> coffeescript "alert 'hi'"
- cc.render(h, optimized: true).should.equal '<script type="text/coffeescript">alert \'hi\'</script>'
+ assert.equal cc.render(h, optimized: true), '<script type="text/coffeescript">alert \'hi\'</script>'
describe 'CoffeeScript helper (object) optimized', ->
describe "coffeescript src: 'script.coffee'", ->
it 'should render <script src="script.coffee" type="text/coffeescript"></script>', ->
h = -> coffeescript src: 'script.coffee'
- cc.render(h, optimized: true).should.equal '<script src="script.coffee" type="text/coffeescript"></script>'
+ assert.equal cc.render(h, optimized: true), '<script src="script.coffee" type="text/coffeescript"></script>'
View
@@ -1,13 +1,14 @@
cc = require '../lib/coffeecup'
+assert = require 'assert'
describe 'Comments', ->
describe 'comment "Comment"', ->
it 'should render <!--Comment-->', ->
c = -> comment "Comment"
- cc.render(c).should.equal '<!--Comment-->'
+ assert.equal cc.render(c), '<!--Comment-->'
describe 'Comments optimized', ->
describe 'comment "Comment"', ->
it 'should render <!--Comment-->', ->
c = -> comment "Comment"
- cc.render(c, optimized: true, cache: on).should.equal '<!--Comment-->'
+ assert.equal cc.render(c, optimized: true, cache: on), '<!--Comment-->'
View
@@ -1,13 +1,14 @@
cc = require '../lib/coffeecup'
+assert = require 'assert'
describe 'Common tag', ->
describe "p 'foo'", ->
it 'should render foo in <p> tag', ->
p = -> p 'foo'
- cc.render(p).should.equal '<p>foo</p>'
+ assert.equal cc.render(p), '<p>foo</p>'
describe 'Common tag optimized', ->
describe "p 'foo'", ->
it 'should render foo in <p> tag', ->
p = -> p 'foo'
- cc.render(p, optimized: true, cache: on).should.equal '<p>foo</p>'
+ assert.equal cc.render(p, optimized: true, cache: on), '<p>foo</p>'
View
@@ -1,25 +1,26 @@
cc = require '../lib/coffeecup'
+assert = require 'assert'
describe 'custom', ->
describe '#tag(name, attr)', ->
it 'should render', ->
t = -> tag 'custom'
- cc.render(t).should.equal '<custom></custom>'
+ assert.equal cc.render(t), '<custom></custom>'
it 'should render with attributes', ->
t = -> tag 'custom', foo: 'bar', ping: 'pong'
- cc.render(t).should.equal '<custom foo="bar" ping="pong"></custom>'
+ assert.equal cc.render(t), '<custom foo="bar" ping="pong"></custom>'
it 'should render with attributes and inner attributes', ->
t = -> tag 'custom', foo: 'bar', ping: 'pong', -> 'zag'
- cc.render(t).should.equal '<custom foo="bar" ping="pong">zag</custom>'
+ assert.equal cc.render(t), '<custom foo="bar" ping="pong">zag</custom>'
describe 'custom optimized', ->
describe '#tag(name, attr)', ->
it 'should render', ->
t = -> tag 'custom'
- cc.render(t, optimized: true, cache: on).should.equal '<custom></custom>'
+ assert.equal cc.render(t, optimized: true, cache: on), '<custom></custom>'
it 'should render with attributes', ->
t = -> tag 'custom', foo: 'bar', ping: 'pong'
- cc.render(t, optimized: true, cache: on).should.equal '<custom foo="bar" ping="pong"></custom>'
+ assert.equal cc.render(t, optimized: true, cache: on), '<custom foo="bar" ping="pong"></custom>'
it 'should render with attributes and inner attributes', ->
t = -> tag 'custom', foo: 'bar', ping: 'pong', -> 'zag'
- cc.render(t, optimized: true, cache: on).should.equal '<custom foo="bar" ping="pong">zag</custom>'
+ assert.equal cc.render(t, optimized: true, cache: on), '<custom foo="bar" ping="pong">zag</custom>'
View
@@ -1,22 +1,23 @@
cc = require '../lib/coffeecup'
+assert = require 'assert'
describe 'doctype', ->
it 'default should render html5 doctype', ->
template = "doctype()"
expected = '<!DOCTYPE html>'
- cc.render(template).should.equal expected
+ assert.equal cc.render(template), expected
it 'xml should render xml header', ->
template = "doctype 'xml'"
expected = '<?xml version="1.0" encoding="utf-8" ?>'
- cc.render(template).should.equal expected
+ assert.equal cc.render(template), expected
it '5 should render html 5 doctype', ->
template = "doctype 5"
expected = '<!DOCTYPE html>'
- cc.render(template).should.equal expected
+ assert.equal cc.render(template), expected
it 'transitional should render transitional doctype', ->
template = "doctype 'transitional'"
expected = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
- cc.render(template).should.equal expected
+ assert.equal cc.render(template), expected
# 'strict': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
# 'frameset': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
@@ -29,16 +30,16 @@ describe 'doctype optimized', ->
it 'default should render html5 doctype', ->
template = "doctype()"
expected = '<!DOCTYPE html>'
- cc.render(template, optimized: true, cache: on).should.equal expected
+ assert.equal cc.render(template, optimized: true, cache: on), expected
it 'xml should render xml header', ->
template = "doctype 'xml'"
expected = '<?xml version="1.0" encoding="utf-8" ?>'
- cc.render(template, optimized: true, cache: on).should.equal expected
+ assert.equal cc.render(template, optimized: true, cache: on), expected
it '5 should render html 5 doctype', ->
template = "doctype 5"
expected = '<!DOCTYPE html>'
- cc.render(template, optimized: true, cache: on).should.equal expected
+ assert.equal cc.render(template, optimized: true, cache: on), expected
it 'transitional should render transitional doctype', ->
template = "doctype 'transitional'"
expected = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
- cc.render(template, optimized: true, cache: on).should.equal expected
+ assert.equal cc.render(template, optimized: true, cache: on), expected
View
@@ -1,26 +1,27 @@
cc = require '../lib/coffeecup'
+assert = require 'assert'
describe 'Escaping', ->
describe "h1 h(\"<script>alert('\"owned\" by c&a &copy;')</script>)", ->
it "should render <h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>", ->
t = -> h1 h("<script>alert('\"owned\" by c&a &copy;')</script>")
- cc.render(t).should.equal "<h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>"
+ assert.equal cc.render(t), "<h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>"
describe 'AutoEscaping', ->
describe "h1 <script>alert('\"owned\" by c&a &copy;')</script>", ->
it "should render <h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>", ->
t = -> h1 "<script>alert('\"owned\" by c&a &copy;')</script>"
- cc.render(t, autoescape: yes).should.equal "<h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>"
+ assert.equal cc.render(t, autoescape: yes), "<h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>"
describe 'Escaping optimized', ->
describe "h1 h(\"<script>alert('\"owned\" by c&a &copy;')</script>)", ->
it "should render <h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>", ->
t = -> h1 h("<script>alert('\"owned\" by c&a &copy;')</script>")
- cc.render(t, optimized: true, cache: on).should.equal "<h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>"
+ assert.equal cc.render(t, optimized: true, cache: on), "<h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>"
describe 'AutoEscaping optimized', ->
describe "h1 <script>alert('\"owned\" by c&a &copy;')</script>", ->
it "should render <h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>", ->
t = -> h1 "<script>alert('\"owned\" by c&a &copy;')</script>"
- cc.render(t, autoescape: yes, optimized: true, cache: on).should.equal "<h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>"
+ assert.equal cc.render(t, autoescape: yes, optimized: true, cache: on), "<h1>&lt;script&gt;alert('&quot;owned&quot; by c&amp;a &amp;copy;')&lt;/script&gt;</h1>"
Oops, something went wrong.

0 comments on commit 13680c0

Please sign in to comment.