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