diff --git a/test/run-tests.py b/test/run-tests.py index 74e5788e..ea1bcc85 100755 --- a/test/run-tests.py +++ b/test/run-tests.py @@ -22,12 +22,12 @@ TESTS = [ 'module/system/stdout.js', 'module/system/stdin.js', 'module/system/stderr.js', + 'standards/javascript/date.js', 'standards/javascript/function.js', 'regression/issue12482.js', 'run-tests.js' ] - def init(): global base_path, phantomjs_exe, options diff --git a/test/standards/javascript/date.js b/test/standards/javascript/date.js new file mode 100644 index 00000000..80bc4925 --- /dev/null +++ b/test/standards/javascript/date.js @@ -0,0 +1,12 @@ +var assert = require('../../assert'); + +// construct date in mm-dd-yyyy format +var date = new Date('2012-09-07'); +assert.isTrue(date.toString() != 'Invalid Date'); +assert.equal(date.getDate(), 6); +assert.equal(date.getMonth(), 8); +assert.equal(date.getYear(), 112); + +// parse date in ISO8601 format (yyyy-mm-dd) +var date = Date.parse("2012-01-01"); +assert.equal(date, 1325376000000); diff --git a/test/webkit-spec.js b/test/webkit-spec.js index 5d391959..b1448f3a 100644 --- a/test/webkit-spec.js +++ b/test/webkit-spec.js @@ -1,14 +1,4 @@ describe("WebKit", function() { - it("should construct date in mm-dd-yyyy format", function() { - var date = new Date('2012-09-07'); - expect(date.toString()).toNotEqual('Invalid Date'); - }); - - it("should parse date in ISO8601 format (yyyy-mm-dd)", function() { - var date = Date.parse("2012-01-01"); - expect(date).toEqual(1325376000000); - }); - it("should not crash when failing to dirty lines while removing a inline.", function () { var p = require("webpage").create(); p.open('../test/webkit-spec/inline-destroy-dirty-lines-crash.html');