Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 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 | |
| 99 |
. |
| 100 | FAIL trimString.trim() should be foo bar. Was foo bar |
| 101 | |
| 102 |
. |
| 103 | FAIL trimString.trimLeft() should be foo bar |
| 104 | |
| 105 |
. Was foo bar |
| 106 | |
| 107 |
. |
| 108 | FAIL trimString.trimRight() should be |
| 109 | |
| 110 |
foo bar. Was |
| 111 | |
| 112 |
foo bar |
| 113 | |
| 114 |
. |
| 115 | FAIL leftTrimString.trim() should be foo bar. Was foo bar |
| 116 | |
| 117 |
. |
| 118 | PASS leftTrimString.trimLeft() is leftTrimString |
| 119 | FAIL leftTrimString.trimRight() should be foo bar. Was foo bar |
| 120 | |
| 121 |
. |
| 122 | FAIL rightTrimString.trim() should be foo bar. Was foo bar. |
| 123 | FAIL rightTrimString.trimLeft() should be foo bar. Was foo bar. |
| 124 | PASS rightTrimString.trimRight() is rightTrimString |
| 125 | PASS trim.call(0) is '0' |
| 126 | PASS trimLeft.call(0) is '0' |
| 127 | PASS trimRight.call(0) is '0' |
| 128 | PASS trim.call(Infinity) is 'Infinity' |
| 129 | PASS trimLeft.call(Infinity) is 'Infinity' |
| 130 | PASS trimRight.call(Infinity) is 'Infinity' |
| 131 | PASS trim.call(NaN) is 'NaN' |
| 132 | PASS trimLeft.call(NaN) is 'NaN' |
| 133 | PASS trimRight.call(NaN) is 'NaN' |
| 134 | PASS trim.call(true) is 'true' |
| 135 | PASS trimLeft.call(true) is 'true' |
| 136 | PASS trimRight.call(true) is 'true' |
| 137 | PASS trim.call(false) is 'false' |
| 138 | PASS trimLeft.call(false) is 'false' |
| 139 | PASS trimRight.call(false) is 'false' |
| 140 | PASS trim.call(({})) is '[object Object]' |
| 141 | PASS trimLeft.call(({})) is '[object Object]' |
| 142 | PASS trimRight.call(({})) is '[object Object]' |
| 143 | PASS trim.call(({toString:function(){return 'wibble'}})) is 'wibble' |
| 144 | PASS trimLeft.call(({toString:function(){return 'wibble'}})) is 'wibble' |
| 145 | PASS trimRight.call(({toString:function(){return 'wibble'}})) is 'wibble' |
| 146 | PASS trim.call(['an','array']) is 'an,array' |
| 147 | PASS trimLeft.call(['an','array']) is 'an,array' |
| 148 | PASS trimRight.call(['an','array']) is 'an,array' |
| 149 | PASS successfullyParsed is true |
| 150 | |
| 151 | TEST COMPLETE |
| 152 | |