Home | History | Annotate | Download | only in webkit
      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 PASS whitespace[21].s.trim() is ''
     93 PASS whitespace[21].s.trimLeft() is ''
     94 PASS whitespace[21].s.trimRight() is ''
     95 PASS wsString.trim() is ''
     96 PASS wsString.trimLeft() is ''
     97 PASS wsString.trimRight() is ''
     98 PASS trimString.trim() is testString
     99 PASS trimString.trimLeft() is leftTrimString
    100 PASS trimString.trimRight() is rightTrimString
    101 PASS leftTrimString.trim() is testString
    102 PASS leftTrimString.trimLeft() is leftTrimString
    103 PASS leftTrimString.trimRight() is testString
    104 PASS rightTrimString.trim() is testString
    105 PASS rightTrimString.trimLeft() is testString
    106 PASS rightTrimString.trimRight() is rightTrimString
    107 PASS trim.call(0) is '0'
    108 PASS trimLeft.call(0) is '0'
    109 PASS trimRight.call(0) is '0'
    110 PASS trim.call(Infinity) is 'Infinity'
    111 PASS trimLeft.call(Infinity) is 'Infinity'
    112 PASS trimRight.call(Infinity) is 'Infinity'
    113 PASS trim.call(NaN) is 'NaN'
    114 PASS trimLeft.call(NaN) is 'NaN'
    115 PASS trimRight.call(NaN) is 'NaN'
    116 PASS trim.call(true) is 'true'
    117 PASS trimLeft.call(true) is 'true'
    118 PASS trimRight.call(true) is 'true'
    119 PASS trim.call(false) is 'false'
    120 PASS trimLeft.call(false) is 'false'
    121 PASS trimRight.call(false) is 'false'
    122 PASS trim.call(({})) is '[object Object]'
    123 PASS trimLeft.call(({})) is '[object Object]'
    124 PASS trimRight.call(({})) is '[object Object]'
    125 PASS trim.call(({toString:function(){return 'wibble'}})) is 'wibble'
    126 PASS trimLeft.call(({toString:function(){return 'wibble'}})) is 'wibble'
    127 PASS trimRight.call(({toString:function(){return 'wibble'}})) is 'wibble'
    128 PASS trim.call(['an','array']) is 'an,array'
    129 PASS trimLeft.call(['an','array']) is 'an,array'
    130 PASS trimRight.call(['an','array']) is 'an,array'
    131 PASS successfullyParsed is true
    132 
    133 TEST COMPLETE
    134 
    135