1# Copyright 2013 the V8 project authors. All rights reserved. 2# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions 6# are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. 9# 2. Redistributions in binary form must reproduce the above copyright 10# notice, this list of conditions and the following disclaimer in the 11# documentation and/or other materials provided with the distribution. 12# 13# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 14# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 24Test to ensure correct behaviour of Object.getOwnPropertyNames 25 26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29PASS getSortedOwnPropertyNames({}) is [] 30PASS getSortedOwnPropertyNames({a:null}) is ['a'] 31PASS getSortedOwnPropertyNames({a:null, b:null}) is ['a', 'b'] 32PASS getSortedOwnPropertyNames({b:null, a:null}) is ['a', 'b'] 33PASS getSortedOwnPropertyNames({__proto__:{a:null}}) is [] 34PASS getSortedOwnPropertyNames({__proto__:[1,2,3]}) is [] 35PASS getSortedOwnPropertyNames(Object.create({}, { 'a': { 'value': 1, 'enumerable': false } })) is ['a'] 36PASS getSortedOwnPropertyNames(Object.create([1,2,3], { 'a': { 'value': 1, 'enumerable': false } })) is ['a'] 37PASS getSortedOwnPropertyNames(new Function()) is ['arguments', 'caller', 'length', 'name', 'prototype'] 38PASS getSortedOwnPropertyNames((function(){var x=new Function();x.__proto__=[1,2,3];return x;})()) is ['arguments', 'caller', 'length', 'name', 'prototype'] 39PASS getSortedOwnPropertyNames(new String('')) is ['length'] 40PASS getSortedOwnPropertyNames(new String('a')) is ['0', 'length'] 41PASS getSortedOwnPropertyNames(new String('abc')) is ['0', '1', '2', 'length'] 42PASS getSortedOwnPropertyNames((function(){var x=new String('');x.__proto__=[1,2,3];return x;})()) is ['length'] 43PASS getSortedOwnPropertyNames([]) is ['length'] 44PASS getSortedOwnPropertyNames([null]) is ['0', 'length'] 45PASS getSortedOwnPropertyNames([null,null]) is ['0','1', 'length'] 46PASS getSortedOwnPropertyNames([null,null,,,,null]) is ['0','1','5', 'length'] 47PASS getSortedOwnPropertyNames((function(){var x=[];x.__proto__=[1,2,3];return x;})()) is ['length'] 48PASS getSortedOwnPropertyNames(new Date()) is [] 49PASS getSortedOwnPropertyNames((function(){var x=new Date();x.__proto__=[1,2,3];return x;})()) is [] 50PASS getSortedOwnPropertyNames(new RegExp('foo')) is ['global', 'ignoreCase', 'lastIndex', 'multiline', 'source'] 51PASS getSortedOwnPropertyNames((function(){var x=new RegExp();x.__proto__=[1,2,3];return x;})()) is ['global', 'ignoreCase', 'lastIndex', 'multiline', 'source'] 52PASS getSortedOwnPropertyNames(argumentsObject()) is ['callee', 'length'] 53PASS getSortedOwnPropertyNames(argumentsObject(1)) is ['0', 'callee', 'length'] 54PASS getSortedOwnPropertyNames(argumentsObject(1,2,3)) is ['0', '1', '2', 'callee', 'length'] 55PASS getSortedOwnPropertyNames((function(){arguments.__proto__=[1,2,3];return arguments;})()) is ['callee', 'length'] 56PASS getSortedOwnPropertyNames(parseInt) is ['arguments', 'caller', 'length', 'name'] 57PASS getSortedOwnPropertyNames(parseFloat) is ['arguments', 'caller', 'length', 'name'] 58PASS getSortedOwnPropertyNames(isNaN) is ['arguments', 'caller', 'length', 'name'] 59PASS getSortedOwnPropertyNames(isFinite) is ['arguments', 'caller', 'length', 'name'] 60PASS getSortedOwnPropertyNames(escape) is ['arguments', 'caller', 'length', 'name'] 61PASS getSortedOwnPropertyNames(unescape) is ['arguments', 'caller', 'length', 'name'] 62PASS getSortedOwnPropertyNames(decodeURI) is ['arguments', 'caller', 'length', 'name'] 63PASS getSortedOwnPropertyNames(decodeURIComponent) is ['arguments', 'caller', 'length', 'name'] 64PASS getSortedOwnPropertyNames(encodeURI) is ['arguments', 'caller', 'length', 'name'] 65PASS getSortedOwnPropertyNames(encodeURIComponent) is ['arguments', 'caller', 'length', 'name'] 66PASS getSortedOwnPropertyNames(Object) is ['arguments', 'caller', 'create', 'defineProperties', 'defineProperty', 'deliverChangeRecords', 'freeze', 'getNotifier', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'observe', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf', 'unobserve'] 67PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'] 68PASS getSortedOwnPropertyNames(Function) is ['arguments', 'caller', 'length', 'name', 'prototype'] 69PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString'] 70PASS getSortedOwnPropertyNames(Array) is ['arguments', 'caller', 'isArray', 'length', 'name', 'observe', 'prototype', 'unobserve'] 71PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift'] 72PASS getSortedOwnPropertyNames(String) is ['arguments', 'caller', 'fromCharCode', 'length', 'name', 'prototype'] 73PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'normalize', 'replace', 'search', 'slice', 'small', 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf'] 74PASS getSortedOwnPropertyNames(Boolean) is ['arguments', 'caller', 'length', 'name', 'prototype'] 75PASS getSortedOwnPropertyNames(Boolean.prototype) is ['constructor', 'toString', 'valueOf'] 76PASS getSortedOwnPropertyNames(Number) is ['EPSILON', 'MAX_SAFE_INTEGER', 'MAX_VALUE', 'MIN_SAFE_INTEGER', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'arguments', 'caller', 'isFinite', 'isInteger', 'isNaN', 'isSafeInteger', 'length', 'name', 'parseFloat', 'parseInt', 'prototype'] 77PASS getSortedOwnPropertyNames(Number.prototype) is ['constructor', 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision', 'toString', 'valueOf'] 78PASS getSortedOwnPropertyNames(Date) is ['UTC', 'arguments', 'caller', 'length', 'name', 'now', 'parse', 'prototype'] 79PASS getSortedOwnPropertyNames(Date.prototype) is ['constructor', 'getDate', 'getDay', 'getFullYear', 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toISOString', 'toJSON', 'toLocaleDateString', 'toLocaleString', 'toLocaleTimeString', 'toString', 'toTimeString', 'toUTCString', 'valueOf'] 80PASS getSortedOwnPropertyNames(RegExp) is ['$&', "$'", '$*', '$+', '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9', '$_', '$`', 'arguments', 'caller', 'input', 'lastMatch', 'lastParen', 'leftContext', 'length', 'multiline', 'name', 'prototype', 'rightContext'] 81PASS getSortedOwnPropertyNames(RegExp.prototype) is ['compile', 'constructor', 'exec', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'test', 'toString'] 82PASS getSortedOwnPropertyNames(Error) is ['arguments', 'caller', 'captureStackTrace', 'length', 'name', 'prototype', 'stackTraceLimit'] 83PASS getSortedOwnPropertyNames(Error.prototype) is ['constructor', 'message', 'name', 'toString'] 84PASS getSortedOwnPropertyNames(Math) is ['E', 'LN10', 'LN2', 'LOG10E', 'LOG2E', 'PI', 'SQRT1_2', 'SQRT2', 'abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'cbrt', 'ceil', 'clz32', 'cos', 'cosh', 'exp', 'expm1', 'floor', 'fround', 'hypot', 'imul', 'log', 'log10', 'log1p', 'log2', 'max', 'min', 'pow', 'random', 'round', 'sign', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc'] 85PASS getSortedOwnPropertyNames(JSON) is ['parse', 'stringify'] 86PASS globalPropertyNames.indexOf('NaN') != -1 is true 87PASS globalPropertyNames.indexOf('Infinity') != -1 is true 88PASS globalPropertyNames.indexOf('undefined') != -1 is true 89PASS globalPropertyNames.indexOf('parseInt') != -1 is true 90PASS globalPropertyNames.indexOf('parseFloat') != -1 is true 91PASS globalPropertyNames.indexOf('isNaN') != -1 is true 92PASS globalPropertyNames.indexOf('isFinite') != -1 is true 93PASS globalPropertyNames.indexOf('escape') != -1 is true 94PASS globalPropertyNames.indexOf('unescape') != -1 is true 95PASS globalPropertyNames.indexOf('decodeURI') != -1 is true 96PASS globalPropertyNames.indexOf('decodeURIComponent') != -1 is true 97PASS globalPropertyNames.indexOf('encodeURI') != -1 is true 98PASS globalPropertyNames.indexOf('encodeURIComponent') != -1 is true 99PASS globalPropertyNames.indexOf('Object') != -1 is true 100PASS globalPropertyNames.indexOf('Function') != -1 is true 101PASS globalPropertyNames.indexOf('Array') != -1 is true 102PASS globalPropertyNames.indexOf('String') != -1 is true 103PASS globalPropertyNames.indexOf('Boolean') != -1 is true 104PASS globalPropertyNames.indexOf('Number') != -1 is true 105PASS globalPropertyNames.indexOf('Date') != -1 is true 106PASS globalPropertyNames.indexOf('RegExp') != -1 is true 107PASS globalPropertyNames.indexOf('Error') != -1 is true 108PASS globalPropertyNames.indexOf('Math') != -1 is true 109PASS globalPropertyNames.indexOf('JSON') != -1 is true 110PASS successfullyParsed is true 111 112TEST COMPLETE 113 114