blob: 1b537e46ea3d7eab912aba66b4e65a8d1a01d062 [file] [log] [blame]
description(
"This test checks that array accessing doesn't do the wrong thing for negative indices"
);
var a = [];
a[-5] = true;
shouldBe('a.length', '0');
shouldBe('a["-5"]', 'a[-5]');
// Just some bounds paranoia
a = [1,2,3,4];
shouldBe('a[4]', 'undefined');
a = [];
for (var i = 0; i > -1000; i--) a[i] = i;