1// 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 5 6(function TestBasics() { 7 var x = 1; 8 var object = {x}; 9 assertEquals(1, object.x); 10})(); 11 12 13(function TestBasicsGetSet() { 14 var get = 1, set = 2; 15 var object = {get, set}; 16 assertEquals(1, object.get); 17 assertEquals(2, object.set); 18})(); 19 20 21(function TestDescriptor() { 22 var x = 1; 23 var object = {x}; 24 var descr = Object.getOwnPropertyDescriptor(object, 'x'); 25 assertEquals(1, descr.value); 26 assertTrue(descr.enumerable); 27 assertTrue(descr.writable); 28 assertTrue(descr.configurable); 29})(); 30 31 32(function TestNotDefined() { 33 'use strict'; 34 assertThrows(function() { 35 return {notDefined}; 36 }, ReferenceError); 37})(); 38 39 40(function TestLet() { 41 var let = 1; 42 var object = {let}; 43 assertEquals(1, object.let); 44})(); 45 46 47(function TestYieldInFunction() { 48 var yield = 1; 49 var object = {yield}; 50 assertEquals(1, object.yield); 51})(); 52 53 54(function TestToString() { 55 function f(x) { return {x}; } 56 assertEquals('function f(x) { return {x}; }', f.toString()); 57})(); 58 59 60(function TestProtoName() { 61 var __proto__ = 1; 62 var object = { 63 __proto__ 64 }; 65 assertEquals(Object.prototype, Object.getPrototypeOf(object)); 66 assertEquals(1, object.__proto__); 67})(); 68 69 70(function TestProtoName2() { 71 var __proto__ = 1; 72 var p = {}; 73 var object = { 74 __proto__: p, 75 __proto__, 76 }; 77 assertEquals(p, Object.getPrototypeOf(object)); 78 assertEquals(1, object.__proto__); 79})(); 80