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 Test regular expression processing with alternatives that match consuming no characters 25 26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29 PASS emptyStr.match(re1) is [""] 30 PASS s1.match(re1) is [""] 31 PASS s2.match(re1) is ["aaaa"] 32 PASS s3.match(re1) is ["aa"] 33 PASS emptyStr.match(re2) is [""] 34 PASS s1.match(re2) is [""] 35 PASS s2.match(re2) is ["aaaa"] 36 PASS s3.match(re2) is ["aa"] 37 PASS emptyStr.match(re3) is [""] 38 PASS s1.match(re3) is [""] 39 PASS s2.match(re3) is ["aaaa"] 40 PASS s3.match(re3) is ["aa"] 41 PASS emptyStr.match(re4) is ["", undefined] 42 PASS s1.match(re4) is ["", undefined] 43 PASS s2.match(re4) is ["aaaa", "a"] 44 PASS s3.match(re4) is ["aa", "a"] 45 PASS emptyStr.match(re5) is ["", undefined] 46 PASS s1.match(re5) is ["", undefined] 47 PASS s2.match(re5) is ["aaaa", "a"] 48 PASS s3.match(re5) is ["aa", "a"] 49 PASS emptyStr.match(re6) is ["", undefined] 50 PASS s1.match(re6) is ["", undefined] 51 PASS s2.match(re6) is ["aaaa", "a"] 52 PASS s3.match(re6) is ["aa", "a"] 53 PASS emptyStr.match(re7) is [""] 54 PASS s1.match(re7) is [""] 55 PASS s2.match(re7) is ["aaa"] 56 PASS s3.match(re7) is ["aa"] 57 PASS emptyStr.match(re8) is [""] 58 PASS s1.match(re8) is [""] 59 PASS s2.match(re8) is ["aaaa"] 60 PASS s3.match(re8) is ["aa"] 61 PASS emptyStr.match(re9) is [""] 62 PASS s1.match(re9) is [""] 63 PASS s2.match(re9) is ["aaaa"] 64 PASS s3.match(re9) is ["aa"] 65 PASS emptyStr.match(re10) is [""] 66 PASS s1.match(re10) is [""] 67 PASS s2.match(re10) is [""] 68 PASS s3.match(re10) is [""] 69 PASS emptyStr.match(re11) is [""] 70 PASS s1.match(re11) is [""] 71 PASS s2.match(re11) is [""] 72 PASS s3.match(re11) is [""] 73 PASS emptyStr.match(re12) is [""] 74 PASS s1.match(re12) is [""] 75 PASS s2.match(re12) is [""] 76 PASS s3.match(re12) is [""] 77 PASS emptyStr.match(re13) is ["", undefined] 78 PASS s1.match(re13) is ["", undefined] 79 PASS s2.match(re13) is ["", undefined] 80 PASS s3.match(re13) is ["", undefined] 81 PASS emptyStr.match(re14) is ["", undefined] 82 PASS s1.match(re14) is ["", undefined] 83 PASS s2.match(re14) is ["", undefined] 84 PASS s3.match(re14) is ["", undefined] 85 PASS emptyStr.match(re15) is ["", undefined] 86 PASS s1.match(re15) is ["", undefined] 87 PASS s2.match(re15) is ["", undefined] 88 PASS s3.match(re15) is ["", undefined] 89 PASS emptyStr.match(re16) is [""] 90 PASS s1.match(re16) is [""] 91 PASS s2.match(re16) is ["a"] 92 PASS s3.match(re16) is ["a"] 93 PASS emptyStr.match(re17) is [""] 94 PASS s1.match(re17) is [""] 95 PASS s2.match(re17) is ["a"] 96 PASS s3.match(re17) is ["a"] 97 PASS emptyStr.match(re18) is [""] 98 PASS s1.match(re18) is [""] 99 PASS s2.match(re18) is ["a"] 100 PASS s3.match(re18) is ["a"] 101 PASS emptyStr.match(re19) is ["", undefined] 102 PASS s1.match(re19) is ["", undefined] 103 PASS s2.match(re19) is ["a", "a"] 104 PASS s3.match(re19) is ["a", "a"] 105 PASS emptyStr.match(re20) is ["", undefined] 106 PASS s1.match(re20) is ["", undefined] 107 PASS s2.match(re20) is ["a", "a"] 108 PASS s3.match(re20) is ["a", "a"] 109 PASS emptyStr.match(re21) is ["", undefined] 110 PASS s1.match(re21) is ["", undefined] 111 PASS s2.match(re21) is ["a", "a"] 112 PASS s3.match(re21) is ["a", "a"] 113 PASS emptyStr.match(re22) is [""] 114 PASS s1.match(re22) is [""] 115 PASS s2.match(re22) is [""] 116 PASS s3.match(re22) is [""] 117 PASS emptyStr.match(re23) is [""] 118 PASS s1.match(re23) is [""] 119 PASS s2.match(re23) is [""] 120 PASS s3.match(re23) is [""] 121 PASS emptyStr.match(re24) is [""] 122 PASS s1.match(re24) is [""] 123 PASS s2.match(re24) is [""] 124 PASS s3.match(re24) is [""] 125 PASS emptyStr.match(re25) is ["", undefined] 126 PASS s1.match(re25) is ["", undefined] 127 PASS s2.match(re25) is ["", undefined] 128 PASS s3.match(re25) is ["", undefined] 129 PASS emptyStr.match(re26) is ["", undefined] 130 PASS s1.match(re26) is ["", undefined] 131 PASS s2.match(re26) is ["", undefined] 132 PASS s3.match(re26) is ["", undefined] 133 PASS emptyStr.match(re27) is ["", undefined] 134 PASS s1.match(re27) is ["", undefined] 135 PASS s2.match(re27) is ["", undefined] 136 PASS s3.match(re27) is ["", undefined] 137 PASS emptyStr.match(re28) is null 138 PASS s1.match(re28) is ["x"] 139 PASS s2.match(re28) is null 140 PASS s3.match(re28) is ["aax"] 141 PASS emptyStr.match(re29) is null 142 PASS s1.match(re29) is ["x"] 143 PASS s2.match(re29) is null 144 PASS s3.match(re29) is ["aax"] 145 PASS emptyStr.match(re30) is null 146 PASS s1.match(re30) is ["x"] 147 PASS s2.match(re30) is null 148 PASS s3.match(re30) is ["aax"] 149 PASS emptyStr.match(re31) is [""] 150 PASS s1.match(re31) is [""] 151 PASS s3.match(re31) is ["aa"] 152 PASS s4.match(re31) is ["abab"] 153 PASS emptyStr.match(re32) is [""] 154 PASS s1.match(re32) is [""] 155 PASS s2.match(re32) is ["aaaa"] 156 PASS s4.match(re32) is ["abab"] 157 PASS s5.match(re32) is ["ab"] 158 PASS s6.match(re32) is [""] 159 PASS emptyStr.match(re33) is [""] 160 PASS s1.match(re33) is [""] 161 PASS s7.match(re33) is ["g0"] 162 PASS emptyStr.match(re34) is [""] 163 PASS s1.match(re34) is [""] 164 PASS s2.match(re34) is [""] 165 PASS s3.match(re34) is [""] 166 PASS successfullyParsed is true 167 168 TEST COMPLETE 169 170