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 page tests handling of parentheses subexpressions. 25 26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29 PASS regexp1.exec('test') is null 30 PASS regexp1.exec('blah') is ['blah'] 31 PASS regexp1.exec('1blah') is ['1blah'] 32 PASS regexp1.exec('blah1') is ['blah1'] 33 PASS regexp1.exec('blah blah blah') is ['blah blah blah'] 34 PASS regexp1.exec('blah\nsecond') is ['blah'] 35 PASS regexp1.exec('first\nblah') is ['blah'] 36 PASS regexp1.exec('first\nblah\nthird') is ['blah'] 37 PASS regexp1.exec('first\nblah2\nblah3') is ['blah2'] 38 PASS regexp2.exec('test') is null 39 PASS regexp2.exec('blah') is ['blah'] 40 PASS regexp2.exec('1blah') is ['1blah'] 41 PASS regexp2.exec('blah1') is ['blah1'] 42 PASS regexp2.exec('blah blah blah') is ['blah blah blah'] 43 PASS regexp2.exec('blah\nsecond') is ['blah'] 44 PASS regexp2.exec('first\nblah') is null 45 PASS regexp2.exec('first\nblah\nthird') is null 46 PASS regexp2.exec('first\nblah2\nblah3') is null 47 PASS regexp3.exec('test') is null 48 PASS regexp3.exec('blah') is ['blah'] 49 PASS regexp3.exec('1blah') is ['1blah'] 50 PASS regexp3.exec('blah1') is ['blah1'] 51 PASS regexp3.exec('blah blah blah') is ['blah blah blah'] 52 PASS regexp3.exec('blah\nsecond') is null 53 PASS regexp3.exec('first\nblah') is ['blah'] 54 PASS regexp3.exec('first\nblah\nthird') is null 55 PASS regexp3.exec('first\nblah2\nblah3') is ['blah3'] 56 PASS regexp4.exec('test') is null 57 PASS regexp4.exec('blah') is ['blah'] 58 PASS regexp4.exec('1blah') is ['1blah'] 59 PASS regexp4.exec('blah1') is ['blah1'] 60 PASS regexp4.exec('blah blah blah') is ['blah blah blah'] 61 PASS regexp4.exec('blah\nsecond') is null 62 PASS regexp4.exec('first\nblah') is null 63 PASS regexp4.exec('first\nblah\nthird') is null 64 PASS regexp4.exec('first\nblah2\nblah3') is null 65 PASS regexp5.exec('test') is null 66 PASS regexp5.exec('blah') is ['blah'] 67 PASS regexp5.exec('1blah') is ['1blah'] 68 PASS regexp5.exec('blah1') is ['blah1'] 69 PASS regexp5.exec('blah blah blah') is ['blah blah blah'] 70 PASS regexp5.exec('blah\nsecond') is ['blah'] 71 PASS regexp5.exec('first\nblah') is ['blah'] 72 PASS regexp5.exec('first\nblah\nthird') is ['blah'] 73 PASS regexp5.exec('first\nblah2\nblah3') is ['blah2'] 74 PASS regexp6.exec('test') is null 75 PASS regexp6.exec('blah') is ['blah'] 76 PASS regexp6.exec('1blah') is ['1blah'] 77 PASS regexp6.exec('blah1') is ['blah'] 78 PASS regexp6.exec('blah blah blah') is ['blah blah blah'] 79 PASS regexp6.exec('blah\nsecond') is ['blah'] 80 PASS regexp6.exec('first\nblah') is ['blah'] 81 PASS regexp6.exec('first\nblah\nthird') is ['blah'] 82 PASS regexp6.exec('first\nblah2\nblah3') is ['blah'] 83 PASS regexp7.exec('test') is null 84 PASS regexp7.exec('blah') is ['blah'] 85 PASS regexp7.exec('1blah') is ['1blah'] 86 PASS regexp7.exec('blah1') is ['blah1'] 87 PASS regexp7.exec('blah blah blah') is ['blah blah blah'] 88 PASS regexp7.exec('blah\nsecond') is null 89 PASS regexp7.exec('first\nblah') is null 90 PASS regexp7.exec('first\nblah\nthird') is null 91 PASS regexp7.exec('first\nblah2\nblah3') is null 92 PASS regexp8.exec('test') is null 93 PASS regexp8.exec('blah') is ['blah',''] 94 PASS regexp8.exec('1blah') is ['1blah','1'] 95 PASS regexp8.exec('blah1') is ['blah1',''] 96 PASS regexp8.exec('blah blah blah') is ['blah blah blah','blah blah '] 97 PASS regexp8.exec('blah\nsecond') is null 98 PASS regexp8.exec('first\nblah') is null 99 PASS regexp8.exec('first\nblah\nthird') is null 100 PASS regexp8.exec('first\nblah2\nblah3') is null 101 PASS regexp9.exec('test') is null 102 PASS regexp9.exec('blah') is ['blah'] 103 PASS regexp9.exec('1blah') is ['1blah'] 104 PASS regexp9.exec('blah1') is ['blah1'] 105 PASS regexp9.exec('blah blah blah') is ['blah blah blah'] 106 PASS regexp9.exec('blah\nsecond') is ['blah'] 107 PASS regexp9.exec('first\nblah') is ['blah'] 108 PASS regexp9.exec('first\nblah\nthird') is ['blah'] 109 PASS regexp9.exec('first\nblah2\nblah3') is ['blah2'] 110 PASS regexp10.exec('test') is null 111 PASS regexp10.exec('blah') is ['blah'] 112 PASS regexp10.exec('1blah') is ['1blah'] 113 PASS regexp10.exec('blah1') is ['blah1'] 114 PASS regexp10.exec('blah blah blah') is ['blah blah blah'] 115 PASS regexp10.exec('blah\nsecond') is ['blah'] 116 PASS regexp10.exec('first\nblah') is ['blah'] 117 PASS regexp10.exec('first\nblah\nthird') is ['blah'] 118 PASS regexp10.exec('first\nblah2\nblah3') is ['blah2'] 119 PASS regexp11.exec('test') is null 120 PASS regexp11.exec('blah') is ['blah'] 121 PASS regexp11.exec('1blah') is ['1blah'] 122 PASS regexp11.exec('blah1') is ['blah1'] 123 PASS regexp11.exec('blah blah blah') is ['blah blah blah'] 124 PASS regexp11.exec('blah\nsecond') is null 125 PASS regexp11.exec('first\nblah') is ['blah'] 126 PASS regexp11.exec('first\nblah\nthird') is null 127 PASS regexp11.exec('first\nblah2\nblah3') is ['blah3'] 128 PASS regexp12.exec('test') is null 129 PASS regexp12.exec('blah') is ['blah'] 130 PASS regexp12.exec('1blah') is ['1blah'] 131 PASS regexp12.exec('blah1') is ['blah1'] 132 PASS regexp12.exec('blah blah blah') is ['blah blah blah'] 133 PASS regexp12.exec('blah\nsecond') is null 134 PASS regexp12.exec('first\nblah') is ['blah'] 135 PASS regexp12.exec('first\nblah\nthird') is null 136 PASS regexp12.exec('first\nblah2\nblah3') is ['blah3'] 137 PASS regexp13.exec('abc\n123') is ['abc\n123'] 138 PASS successfullyParsed is true 139 140 TEST COMPLETE 141 142