summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/TypedObject/array-hasproperty.js
blob: 3e119af339d5abd290f7f68fc36be3d43c7fd69f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
if (!this.hasOwnProperty("TypedObject"))
  quit();

var array = new (TypedObject.uint8.array(5));

for (var i = 0; i < array.length; i++)
    assertEq(i in array, true);

for (var v of [20, 300, -1, 5, -10, Math.pow(2, 32) - 1, -Math.pow(2, 32)])
    assertEq(v in array, false);

// Don't inherit elements
array.__proto__[50] = "hello";
assertEq(array.__proto__[50], "hello");
assertEq(50 in array, false);

// Do inherit normal properties
array.__proto__.a = "world";
assertEq(array.__proto__.a, "world");
assertEq("a" in array, true);