1// Copyright JS Foundation and other contributors, http://js.foundation 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15assert (JSON.stringify (Object.getOwnPropertyNames("hello")) === '["0","1","2","3","4","length"]'); 16 17var n = Object.assign(42, {a: "str"}); 18assert (n instanceof Number); 19assert (n.valueOf() === 42); 20assert (n.a === "str"); 21 22assert (JSON.stringify (Object.getOwnPropertySymbols("hello")) === '[]'); 23 24assert (JSON.stringify (Object.keys("str")) === '["0","1","2"]'); 25 26var d = Object.getOwnPropertyDescriptor("hello", '1'); 27assert (d.value === "e"); 28assert (d.writable === false); 29assert (d.enumerable === true); 30assert (d.configurable === false); 31 32assert (Object.seal(42) === 42); 33assert (Object.seal("a") === "a"); 34assert (Object.seal(undefined) === undefined); 35assert (Object.seal() === undefined); 36 37assert (Object.isSealed(42) === true); 38assert (Object.isSealed("a") === true); 39assert (Object.isSealed(undefined) === true); 40assert (Object.isSealed() === true); 41 42assert (Object.freeze(42) === 42); 43assert (Object.freeze("a") === "a"); 44assert (Object.freeze(undefined) === undefined); 45assert (Object.freeze() === undefined); 46 47assert (Object.isFrozen(42) === true); 48assert (Object.isFrozen("a") === true); 49assert (Object.isFrozen(undefined) === true); 50assert (Object.isFrozen() === true); 51 52assert (Object.preventExtensions(42) === 42); 53assert (Object.preventExtensions("a") === "a"); 54assert (Object.preventExtensions(undefined) === undefined); 55assert (Object.preventExtensions() === undefined); 56 57assert (Object.isExtensible(42) === false); 58assert (Object.isExtensible("a") === false); 59assert (Object.isExtensible(undefined) === false); 60assert (Object.isExtensible() === false); 61