v8/test/mjsunit/es6/built-in-accessor-names.js
arv 07c1f277bd Unship harmony tostring
Blink's DOM bindings are not yet ready.

BUG=493137, 239915
LOG=N
R=rossberg, adamk
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_chromium_rel_ng;tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1153263004

Cr-Commit-Position: refs/heads/master@{#28804}
2015-06-04 17:33:33 +00:00

54 lines
1.5 KiB
JavaScript

// 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.
// Flags: --harmony-tostring
'use strict';
function assertGetterName(expected, object, name) {
var descr = Object.getOwnPropertyDescriptor(object, name);
assertSame(expected, descr.get.name);
}
function assertSetterName(expected, object, name) {
var descr = Object.getOwnPropertyDescriptor(object, name);
assertSame(expected, descr.set.name);
}
assertGetterName('get byteLength', ArrayBuffer.prototype, 'byteLength');
assertGetterName('get size', Set.prototype, 'size');
assertGetterName('get size', Map.prototype, 'size');
let typedArrays = [
Uint8Array,
Int8Array,
Uint16Array,
Int16Array,
Uint32Array,
Int32Array,
Float32Array,
Float64Array,
Uint8ClampedArray
];
for (let f of typedArrays) {
assertGetterName('get buffer', f.prototype, 'buffer');
assertGetterName('get byteOffset', f.prototype, 'byteOffset');
assertGetterName('get byteLength', f.prototype, 'byteLength');
assertGetterName('get length', f.prototype, 'length');
assertGetterName('get [Symbol.toStringTag]', f.prototype, Symbol.toStringTag);
}
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__');