Home | History | Annotate | Download | only in js
      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 for a regression against String#split is buggy.
     25 
     26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     27 
     28 
     29 PASS ''.split() is testCode[i][1]
     30 PASS ''.split(/./) is testCode[i][1]
     31 PASS ''.split(/.?/) is testCode[i][1]
     32 PASS ''.split(/.??/) is testCode[i][1]
     33 PASS 'ab'.split(/a*/) is testCode[i][1]
     34 PASS 'ab'.split(/a*?/) is testCode[i][1]
     35 PASS 'ab'.split(/(?:ab)/) is testCode[i][1]
     36 PASS 'ab'.split(/(?:ab)*/) is testCode[i][1]
     37 PASS 'ab'.split(/(?:ab)*?/) is testCode[i][1]
     38 PASS 'test'.split('') is testCode[i][1]
     39 PASS 'test'.split() is testCode[i][1]
     40 PASS '111'.split(1) is testCode[i][1]
     41 PASS 'test'.split(/(?:)/, 2) is testCode[i][1]
     42 PASS 'test'.split(/(?:)/, -1) is testCode[i][1]
     43 PASS 'test'.split(/(?:)/, undefined) is testCode[i][1]
     44 PASS 'test'.split(/(?:)/, null) is testCode[i][1]
     45 PASS 'test'.split(/(?:)/, NaN) is testCode[i][1]
     46 PASS 'test'.split(/(?:)/, true) is testCode[i][1]
     47 PASS 'test'.split(/(?:)/, '2') is testCode[i][1]
     48 PASS 'test'.split(/(?:)/, 'two') is testCode[i][1]
     49 PASS 'a'.split(/-/) is testCode[i][1]
     50 PASS 'a'.split(/-?/) is testCode[i][1]
     51 PASS 'a'.split(/-??/) is testCode[i][1]
     52 PASS 'a'.split(/a/) is testCode[i][1]
     53 PASS 'a'.split(/a?/) is testCode[i][1]
     54 PASS 'a'.split(/a??/) is testCode[i][1]
     55 PASS 'ab'.split(/-/) is testCode[i][1]
     56 PASS 'ab'.split(/-?/) is testCode[i][1]
     57 PASS 'ab'.split(/-??/) is testCode[i][1]
     58 PASS 'a-b'.split(/-/) is testCode[i][1]
     59 PASS 'a-b'.split(/-?/) is testCode[i][1]
     60 PASS 'a-b'.split(/-??/) is testCode[i][1]
     61 PASS 'a--b'.split(/-/) is testCode[i][1]
     62 PASS 'a--b'.split(/-?/) is testCode[i][1]
     63 PASS 'a--b'.split(/-??/) is testCode[i][1]
     64 PASS ''.split(/()()/) is testCode[i][1]
     65 PASS '.'.split(/()()/) is testCode[i][1]
     66 PASS '.'.split(/(.?)(.?)/) is testCode[i][1]
     67 PASS '.'.split(/(.??)(.??)/) is testCode[i][1]
     68 PASS '.'.split(/(.)?(.)?/) is testCode[i][1]
     69 PASS 'A<B>bold</B>and<CODE>coded</CODE>'.split(ecmaSampleRe) is testCode[i][1]
     70 PASS 'tesst'.split(/(s)*/) is testCode[i][1]
     71 PASS 'tesst'.split(/(s)*?/) is testCode[i][1]
     72 PASS 'tesst'.split(/(s*)/) is testCode[i][1]
     73 PASS 'tesst'.split(/(s*?)/) is testCode[i][1]
     74 PASS 'tesst'.split(/(?:s)*/) is testCode[i][1]
     75 PASS 'tesst'.split(/(?=s+)/) is testCode[i][1]
     76 PASS 'test'.split('t') is testCode[i][1]
     77 PASS 'test'.split('es') is testCode[i][1]
     78 PASS 'test'.split(/t/) is testCode[i][1]
     79 PASS 'test'.split(/es/) is testCode[i][1]
     80 PASS 'test'.split(/(t)/) is testCode[i][1]
     81 PASS 'test'.split(/(es)/) is testCode[i][1]
     82 PASS 'test'.split(/(t)(e)(s)(t)/) is testCode[i][1]
     83 PASS '.'.split(/(((.((.??)))))/) is testCode[i][1]
     84 PASS '.'.split(/(((((.??)))))/) is testCode[i][1]
     85 PASS 'hello'.split({toString:function(){return 'e';}}) is ["h", "llo"]
     86 PASS var a = 'hello'.split({toString:function(){separatorToStringCalled='OKAY';return 'e';}},0); a.push(separatorToStringCalled); a is ["OKAY"]
     87 PASS successfullyParsed is true
     88 
     89 TEST COMPLETE
     90 
     91