Add throwing of missing range error to Date.prototype.toISOString()

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
This commit is contained in:
Roland Takacs
2015-08-03 10:09:31 +02:00
parent 6082c32d45
commit 1b05cc47ff
2 changed files with 22 additions and 4 deletions
+20 -1
View File
@@ -65,10 +65,29 @@ catch (e)
assert (e.message === "Incompatible type");
}
assert (new Date (NaN).toISOString () == "Invalid Date");
assert (new Date ("2015-07-16").toISOString () == "2015-07-16T00:00:00.000Z");
assert (new Date ("2015-07-16T11:29:05.023").toISOString () == "2015-07-16T11:29:05.023Z");
try
{
new Date (NaN).toISOString ();
assert (false);
}
catch (e)
{
assert (e instanceof RangeError);
}
try
{
new Date (Number.POSITIVE_INFINITY).toISOString ();
assert (false);
}
catch (e)
{
assert (e instanceof RangeError);
}
try
{
Date.prototype.toISOString.call(-1);