Fix [[Construct]] call for Date()

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
This commit is contained in:
Roland Takacs
2015-07-27 13:54:19 +02:00
parent f7781bb7bc
commit b5923ccd9d
6 changed files with 108 additions and 84 deletions
+7 -13
View File
@@ -31,21 +31,9 @@ catch (e)
assert (isNaN(Date.prototype.valueOf.call(Date.prototype)));
d = Date("abcd");
d = new Date("abcd");
assert (isNaN(d.valueOf()));
d = Date();
assert (!isNaN(d.valueOf()));
d = Date("2015-01-01");
assert (d.valueOf() == 1420070400000);
d = Date(1420070400000);
assert (d.valueOf() == 1420070400000);
d = Date(2015,0,1,0,0,0,0);
assert (d.valueOf() == 1420070400000);
d = new Date();
assert (!isNaN(d.valueOf()));
@@ -82,3 +70,9 @@ catch (e)
assert (e instanceof ReferenceError);
assert (e.message === "valueOf-1");
}
assert (typeof Date (2015) == "string");
assert (typeof Date() != typeof (new Date ()));
assert (Date (Number.NaN) == Date ());
// Fixme: remove this case when Date() gives the current time.
assert (Date (2015,1,2) == "1970-01-01T00:00:00.000");