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 24This test checks String.trim(), String.trimLeft() and String.trimRight() methods. 25 26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29PASS whitespace[0].s.trim() is '' 30PASS whitespace[0].s.trimLeft() is '' 31PASS whitespace[0].s.trimRight() is '' 32PASS whitespace[1].s.trim() is '' 33PASS whitespace[1].s.trimLeft() is '' 34PASS whitespace[1].s.trimRight() is '' 35PASS whitespace[2].s.trim() is '' 36PASS whitespace[2].s.trimLeft() is '' 37PASS whitespace[2].s.trimRight() is '' 38PASS whitespace[3].s.trim() is '' 39PASS whitespace[3].s.trimLeft() is '' 40PASS whitespace[3].s.trimRight() is '' 41PASS whitespace[4].s.trim() is '' 42PASS whitespace[4].s.trimLeft() is '' 43PASS whitespace[4].s.trimRight() is '' 44PASS whitespace[5].s.trim() is '' 45PASS whitespace[5].s.trimLeft() is '' 46PASS whitespace[5].s.trimRight() is '' 47PASS whitespace[6].s.trim() is '' 48PASS whitespace[6].s.trimLeft() is '' 49PASS whitespace[6].s.trimRight() is '' 50PASS whitespace[7].s.trim() is '' 51PASS whitespace[7].s.trimLeft() is '' 52PASS whitespace[7].s.trimRight() is '' 53PASS whitespace[8].s.trim() is '' 54PASS whitespace[8].s.trimLeft() is '' 55PASS whitespace[8].s.trimRight() is '' 56PASS whitespace[9].s.trim() is '' 57PASS whitespace[9].s.trimLeft() is '' 58PASS whitespace[9].s.trimRight() is '' 59PASS whitespace[10].s.trim() is '' 60PASS whitespace[10].s.trimLeft() is '' 61PASS whitespace[10].s.trimRight() is '' 62PASS whitespace[11].s.trim() is '' 63PASS whitespace[11].s.trimLeft() is '' 64PASS whitespace[11].s.trimRight() is '' 65PASS whitespace[12].s.trim() is '' 66PASS whitespace[12].s.trimLeft() is '' 67PASS whitespace[12].s.trimRight() is '' 68PASS whitespace[13].s.trim() is '' 69PASS whitespace[13].s.trimLeft() is '' 70PASS whitespace[13].s.trimRight() is '' 71PASS whitespace[14].s.trim() is '' 72PASS whitespace[14].s.trimLeft() is '' 73PASS whitespace[14].s.trimRight() is '' 74PASS whitespace[15].s.trim() is '' 75PASS whitespace[15].s.trimLeft() is '' 76PASS whitespace[15].s.trimRight() is '' 77PASS whitespace[16].s.trim() is '' 78PASS whitespace[16].s.trimLeft() is '' 79PASS whitespace[16].s.trimRight() is '' 80PASS whitespace[17].s.trim() is '' 81PASS whitespace[17].s.trimLeft() is '' 82PASS whitespace[17].s.trimRight() is '' 83PASS whitespace[18].s.trim() is '' 84PASS whitespace[18].s.trimLeft() is '' 85PASS whitespace[18].s.trimRight() is '' 86PASS whitespace[19].s.trim() is '' 87PASS whitespace[19].s.trimLeft() is '' 88PASS whitespace[19].s.trimRight() is '' 89PASS whitespace[20].s.trim() is '' 90PASS whitespace[20].s.trimLeft() is '' 91PASS whitespace[20].s.trimRight() is '' 92FAIL whitespace[21].s.trim() should be . Was . 93FAIL whitespace[21].s.trimLeft() should be . Was . 94FAIL whitespace[21].s.trimRight() should be . Was . 95FAIL wsString.trim() should be . Was . 96FAIL wsString.trimLeft() should be . Was . 97FAIL wsString.trimRight() should be . Was 98 99 . 100FAIL trimString.trim() should be foo bar. Was foo bar 101 102 . 103FAIL trimString.trimLeft() should be foo bar 104 105 . Was foo bar 106 107 . 108FAIL trimString.trimRight() should be 109 110 foo bar. Was 111 112 foo bar 113 114 . 115FAIL leftTrimString.trim() should be foo bar. Was foo bar 116 117 . 118PASS leftTrimString.trimLeft() is leftTrimString 119FAIL leftTrimString.trimRight() should be foo bar. Was foo bar 120 121 . 122FAIL rightTrimString.trim() should be foo bar. Was foo bar. 123FAIL rightTrimString.trimLeft() should be foo bar. Was foo bar. 124PASS rightTrimString.trimRight() is rightTrimString 125PASS trim.call(0) is '0' 126PASS trimLeft.call(0) is '0' 127PASS trimRight.call(0) is '0' 128PASS trim.call(Infinity) is 'Infinity' 129PASS trimLeft.call(Infinity) is 'Infinity' 130PASS trimRight.call(Infinity) is 'Infinity' 131PASS trim.call(NaN) is 'NaN' 132PASS trimLeft.call(NaN) is 'NaN' 133PASS trimRight.call(NaN) is 'NaN' 134PASS trim.call(true) is 'true' 135PASS trimLeft.call(true) is 'true' 136PASS trimRight.call(true) is 'true' 137PASS trim.call(false) is 'false' 138PASS trimLeft.call(false) is 'false' 139PASS trimRight.call(false) is 'false' 140PASS trim.call(({})) is '[object Object]' 141PASS trimLeft.call(({})) is '[object Object]' 142PASS trimRight.call(({})) is '[object Object]' 143PASS trim.call(({toString:function(){return 'wibble'}})) is 'wibble' 144PASS trimLeft.call(({toString:function(){return 'wibble'}})) is 'wibble' 145PASS trimRight.call(({toString:function(){return 'wibble'}})) is 'wibble' 146PASS trim.call(['an','array']) is 'an,array' 147PASS trimLeft.call(['an','array']) is 'an,array' 148PASS trimRight.call(['an','array']) is 'an,array' 149PASS successfullyParsed is true 150 151TEST COMPLETE 152 153