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