blob: fe4be4eb3e852bb0d7e6bc0f3c99fa2dea45870f [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// Copyright 2014 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5var array = [];
6var v = 0;
7
8Object.defineProperty(Array.prototype, "0", {
9 get: function() { return "get " + v; },
10 set: function(value) { v += value; }
11});
12
13array[0] = 10;
14assertEquals(0, array.length);
15assertEquals(10, v);
16assertEquals("get 10", array[0]);
17
18array.push(100);
19assertEquals(1, array.length);
20assertEquals(110, v);
21assertEquals("get 110", array[0]);