forked from samsonjs/strftime
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
1 parent
86e8bbf
commit 644bb65
Showing
1 changed file
with
36 additions
and
0 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 |
---|---|---|
@@ -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)}" | ||
|