Fix the indexing of Array builtin functions.

The index-dependant builtins didn't handle correctly the positive Infinity value.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This commit is contained in:
Zsolt Borbély
2015-06-16 12:37:28 +02:00
committed by Peter Gal
parent caa1617ea2
commit 3f28cb3bf8
8 changed files with 187 additions and 204 deletions
+4
View File
@@ -33,6 +33,10 @@ var index = array.indexOf(obj);
assert(index === 3);
assert(array[index] === obj);
assert(array.indexOf("foo", NaN) === 0);
assert(array.indexOf("foo", Infinity) === -1);
assert(array.indexOf("foo", -Infinity) === 0);
// Checking behavior when length is zero
var obj = { indexOf : Array.prototype.indexOf, length : 0 };
assert(obj.indexOf("foo") === -1);