built-in-accessor-names.js 1.38 KB
Newer Older
1 2 3 4 5 6
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

'use strict';

7 8
function assertGetterName(expected, object, name) {
  var descr = Object.getOwnPropertyDescriptor(object, name);
9 10 11 12
  assertSame(expected, descr.get.name);
}


13 14
function assertSetterName(expected, object, name) {
  var descr = Object.getOwnPropertyDescriptor(object, name);
15 16 17 18 19 20 21 22 23
  assertSame(expected, descr.set.name);
}


assertGetterName('get byteLength', ArrayBuffer.prototype, 'byteLength');
assertGetterName('get size', Set.prototype, 'size');
assertGetterName('get size', Map.prototype, 'size');


24 25 26 27 28 29 30
let TypedArray = Uint8Array.__proto__;

assertGetterName('get buffer', TypedArray.prototype, 'buffer');
assertGetterName('get byteOffset', TypedArray.prototype, 'byteOffset');
assertGetterName('get byteLength', TypedArray.prototype, 'byteLength');
assertGetterName('get length', TypedArray.prototype, 'length');
assertGetterName('get [Symbol.toStringTag]', TypedArray.prototype, Symbol.toStringTag);
31 32 33 34 35 36 37 38 39


assertGetterName('get buffer', DataView.prototype, 'buffer');
assertGetterName('get byteOffset', DataView.prototype, 'byteOffset');
assertGetterName('get byteLength', DataView.prototype, 'byteLength');


assertGetterName('get __proto__', Object.prototype, '__proto__');
assertSetterName('set __proto__', Object.prototype, '__proto__');