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 24KDE JS Test 25 26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29PASS Array().length is 0 30PASS (new Array()).length is 0 31PASS (new Array(3)).length is 3 32PASS (new Array(11, 22)).length is 2 33PASS (new Array(11, 22))[0] is 11 34PASS Array(11, 22)[1] is 22 35PASS (new Array(11, 22))[3] is undefined. 36PASS String(new Array(11, 22)) is '11,22' 37PASS var a = []; a[0] = 33; a[0] is 33 38PASS var a = []; a[0] = 33; a.length is 1 39PASS var a = [11, 22]; a.length = 1; String(a); is '11' 40PASS var a = [11, 22]; a.length = 1; a.length; is 1 41PASS caught; is true 42PASS ename is 'RangeError' 43PASS caught; is true 44PASS ename is 'RangeError' 45PASS var a = [11, 22]; a.length = 1; a[1]; is undefined. 46PASS Array().toString() is '' 47PASS Array(3).toString() is ',,' 48PASS Array(11, 22).toString() is '11,22' 49PASS String(Array(11, 22).concat(33)) is '11,22,33' 50PASS String(Array(2).concat(33, 44)) is ',,33,44' 51PASS String(Array(2).concat(Array(2))) is ',,,' 52PASS String(Array(11,22).concat(Array(33,44))) is '11,22,33,44' 53PASS String(Array(1,2).concat(3,Array(4,5))) is '1,2,3,4,5' 54PASS var a = new Array(1,2,3); delete a[1]; String(a.concat(4)) is '1,,3,4' 55PASS [1,2,3,4].slice(1, 3).toString() is '2,3' 56PASS [1,2,3,4].slice(-3, -1).toString() is '2,3' 57PASS [1,2].slice(-9, 0).length is 0 58PASS [1,2].slice(1).toString() is '2' 59PASS [1,2].slice().toString() is '1,2' 60PASS (new Array('a')).length is 1 61PASS (new Array('a'))[0] is 'a' 62PASS (new Array('a'))[1] is undefined. 63PASS Array('a').length is 1 64PASS Array('a')[0] is 'a' 65PASS String(Array()) is '' 66PASS String(Array('a','b')) is 'a,b' 67PASS [].length is 0 68PASS ['a'].length is 1 69PASS ['a'][0] is 'a' 70PASS ['a',,'c'][2] is 'c' 71PASS ['a',undefined,'c'][1] is undefined 72PASS ['a',,'c'][1] is undefined 73PASS 1 in ['a',,'c'] is false 74PASS 1 in ['a',undefined,'c'] is true 75PASS 1 in arrayWithDeletion is false 76PASS forInSum([]) is '' 77PASS forInSum(Array()) is '' 78PASS forInSum(Array('a')) is 'a' 79PASS forInSum([,undefined,'x','aa']) is 'undefinedxaa' 80PASS forInSum(a0) is '' 81PASS forInSum(a1) is 'a' 82PASS String([].sort()) is '' 83PASS String([3,1,'2'].sort()) is '1,2,3' 84PASS String([,'x','aa'].sort()) is 'aa,x,' 85PASS String([,undefined,'x','aa'].sort()) is 'aa,x,,' 86PASS 2 in [,undefined,'x','aa'].sort() is true 87PASS 3 in [,undefined,'x','aa'].sort() is false 88PASS var a = ['aa', 'b', 'cccc', 'ddd']; String(a.sort(comp)) is 'b,aa,ddd,cccc' 89PASS [0, Infinity].sort(function(a, b) { return a - b }).toString() is '0,Infinity' 90PASS [].unshift('a') is 1 91PASS ['c'].unshift('a', 'b') is 3 92PASS var a = []; a.unshift('a'); String(a) is 'a' 93PASS var a = ['c']; a.unshift('a', 'b'); String(a) is 'a,b,c' 94PASS String(['a', 'b', 'c'].splice(1, 2, 'x', 'y')) is 'b,c' 95PASS arr.length is 40 96PASS arr[maxint] is "test" 97PASS arr.length is 40 98PASS arr[maxint] is undefined 99PASS arr.length is maxint 100PASS arr[maxint-1] is "test2" 101PASS arr.length is 40 102PASS arr[55.5] is "test" 103PASS arr[65.11111111111111111111111111111] is "test" 104PASS arr.length is 40 105PASS arr[55.5] is undefined 106PASS arr[65.11111111111111111111111111111] is undefined 107PASS propnames.length is 3 108PASS propnames[0] is '0' 109PASS propnames[1] is '1' 110PASS propnames[2] is '2' 111PASS successfullyParsed is true 112 113TEST COMPLETE 114 115