Skip to content

Commit

Permalink
add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewschaaf committed Jun 7, 2011
1 parent 86e8bbf commit 644bb65
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/test.coffee
@@ -0,0 +1,36 @@

assert = require 'assert'

lib = require './../lib'


# Tue, 07 Jun 2011 18:51:45 GMT
t = new Date 1307472705867


TESTS = [

["%Y", "2011", "2011"]

["%m", "06"]
["%b", "Jun", "Jun"]
["%B", "June", "June"]

["%d", null, "07"]

["%H", null, "18"]

["%M", "51", "51"]

["%S", "45", "45"]

["%s", "1307472705"]
]

for [format, expectedNonUTC, expectedUTC] in TESTS
expectedUTC or= expectedNonUTC
for [name, expected] in [['strftime', expectedNonUTC], ['strftimeUTC', expectedUTC]]
if expected
got = lib[name] format, t
assert.equal expected, got, "Error for #{name}(#{JSON.stringify(format)}, t): expected #{JSON.stringify(expected)}, got #{JSON.stringify(got)}"

0 comments on commit 644bb65

Please sign in to comment.