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:
@@ -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");
|
||||
|
||||
@@ -44,7 +44,7 @@ catch (e)
|
||||
}
|
||||
|
||||
assert (new Date (NaN).toTimeString () == "Invalid Date");
|
||||
assert (Date (Number.POSITIVE_INFINITY).toString () === "Invalid Date");
|
||||
assert (new Date (Number.POSITIVE_INFINITY).toString () === "Invalid Date");
|
||||
assert (new Date ("2015-02-13").toTimeString () == "00:00:00.000");
|
||||
assert (new Date ("2015-07-08T11:29:05.023").toTimeString () == "11:29:05.023");
|
||||
|
||||
@@ -105,3 +105,9 @@ catch (e)
|
||||
|
||||
date_time = new Date ("2015-07-08T11:29:05.023").toJSON ();
|
||||
assert (new Date (date_time) == "2015-07-08T11:29:05.023");
|
||||
|
||||
assert (typeof Date (2015) == "string");
|
||||
assert (typeof Date() != typeof (new Date ()));
|
||||
assert (Date () == (new Date ()).toString ());
|
||||
assert (Date (2015, 1, 1) == (new Date ()).toString ());
|
||||
assert (Date (Number.NaN) == Date ());
|
||||
|
||||
Reference in New Issue
Block a user