Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,34 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests for length miscalculations in regular expression processing.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS re.exec('a') is null
PASS re2.test('') is false
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,33 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"This page tests for length miscalculations in regular expression processing."
);
var re = /b|[^b]/g;
re.lastIndex = 1;
shouldBe("re.exec('a')", "null");
var re2 = /[^a]|ab/;
shouldBe("re2.test('')", "false");

View File

@ -0,0 +1,69 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests handling of parenthetical assertions.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS regex1.exec('xx') is ['xx','x']
PASS regex2.exec('baaabaac') is ['baaabaac','ba',undefined,'abaac']
PASS regex3.exec('aaab') is ['aab','a','aab']
PASS regex4.exec('aaab') is ['aab','a','aab']
PASS regex5.exec('P11') is ['P11','1','1']
PASS regex6.exec('ababbbcbc') is ['ababb','bb','b']
PASS regex7.exec('xx') is ['xx','x']
PASS regex8.exec('xx') is ['xx','x','x']
PASS regex9.exec('xy') is null
PASS regex10.exec('xy') is null
PASS regex11.exec('xy') is null
PASS regex12.exec('x') is null
PASS regex12.exec('xx') is ['xx','x']
PASS regex12.exec('xxy') is ['xx','x']
PASS regex13.exec('xzzzx') is ['xzzzx','x']
PASS regex13.exec('xzzzxy') is ['xzzzx','x']
PASS regex14.exec('aabc') is ['aabc','a','bc']
PASS regex14.exec('aabcx') is ['aabc','a','bc']
PASS regex15.exec('aabc') is ['aabc','a','bc']
PASS regex15.exec('aabcx') is ['aabc','a','bc']
PASS regex16.exec('ab') is null
PASS regex16.exec('abc') is ['abc','bc']
PASS regex17.exec('ab') is ['a','ab']
PASS regex17.exec('abc') is ['a','ab']
PASS regex18.exec('x') is ['x','']
PASS regex18.exec('xx') is ['x','xx']
PASS regex18.exec('xxx') is ['x','xx']
PASS regex19.exec('x') is ['x','',undefined]
PASS regex19.exec('xx') is ['x','xx','xx']
PASS regex19.exec('xxx') is ['x','xx','xx']
PASS regex20.exec('x') is null
PASS regex20.exec('xx') is ['x','xx']
PASS regex20.exec('xxx') is ['x','xx']
PASS regex21.exec('aab') is ['aab']
PASS regex22.exec('55up') is null
PASS regex23.exec('ax') is null
PASS regex24.exec('x') is null
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,109 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("This page tests handling of parenthetical assertions.");
var regex1 = /(x)(?=\1)x/;
shouldBe("regex1.exec('xx')", "['xx','x']");
var regex2 = /(.*?)a(?!(a+)b\2c)\2(.*)/;
shouldBe("regex2.exec('baaabaac')", "['baaabaac','ba',undefined,'abaac']");
var regex3 = /(?=(a+?))(\1ab)/;
shouldBe("regex3.exec('aaab')", "['aab','a','aab']");
var regex4 = /(?=(a+?))(\1ab)/;
shouldBe("regex4.exec('aaab')", "['aab','a','aab']");
var regex5 = /^P([1-6])(?=\1)([1-6])$/;
shouldBe("regex5.exec('P11')", "['P11','1','1']");
var regex6 = /(([a-c])b*?\2)*/;
shouldBe("regex6.exec('ababbbcbc')", "['ababb','bb','b']");
var regex7 = /(x)(?=x)x/;
shouldBe("regex7.exec('xx')", "['xx','x']");
var regex8 = /(x)(\1)/;
shouldBe("regex8.exec('xx')", "['xx','x','x']");
var regex9 = /(x)(?=\1)x/;
shouldBeNull("regex9.exec('xy')");
var regex10 = /(x)(?=x)x/;
shouldBeNull("regex10.exec('xy')");
var regex11 = /(x)(\1)/;
shouldBeNull("regex11.exec('xy')");
var regex12 = /(x)(?=\1)x/;
shouldBeNull("regex12.exec('x')");
shouldBe("regex12.exec('xx')", "['xx','x']");
shouldBe("regex12.exec('xxy')", "['xx','x']");
var regex13 = /(x)zzz(?=\1)x/;
shouldBe("regex13.exec('xzzzx')", "['xzzzx','x']");
shouldBe("regex13.exec('xzzzxy')", "['xzzzx','x']");
var regex14 = /(a)\1(?=(b*c))bc/;
shouldBe("regex14.exec('aabc')", "['aabc','a','bc']");
shouldBe("regex14.exec('aabcx')", "['aabc','a','bc']");
var regex15 = /(a)a(?=(b*c))bc/;
shouldBe("regex15.exec('aabc')", "['aabc','a','bc']");
shouldBe("regex15.exec('aabcx')", "['aabc','a','bc']");
var regex16 = /a(?=(b*c))bc/;
shouldBeNull("regex16.exec('ab')");
shouldBe("regex16.exec('abc')", "['abc','bc']");
var regex17 = /(?=((?:ab)*))a/;
shouldBe("regex17.exec('ab')", "['a','ab']");
shouldBe("regex17.exec('abc')", "['a','ab']");
var regex18 = /(?=((?:xx)*))x/;
shouldBe("regex18.exec('x')", "['x','']");
shouldBe("regex18.exec('xx')", "['x','xx']");
shouldBe("regex18.exec('xxx')", "['x','xx']");
var regex19 = /(?=((xx)*))x/;
shouldBe("regex19.exec('x')", "['x','',undefined]");
shouldBe("regex19.exec('xx')", "['x','xx','xx']");
shouldBe("regex19.exec('xxx')", "['x','xx','xx']");
var regex20 = /(?=(xx))+x/;
shouldBeNull("regex20.exec('x')");
shouldBe("regex20.exec('xx')", "['x','xx']");
shouldBe("regex20.exec('xxx')", "['x','xx']");
var regex21 = /(?=a+b)aab/;
shouldBe("regex21.exec('aab')", "['aab']");
var regex22 = /(?!(u|m{0,}g+)u{1,}|2{2,}!1%n|(?!K|(?=y)|(?=ip))+?)(?=(?=(((?:7))*?)*?))p/m;
shouldBe("regex22.exec('55up')", "null");
var regex23 = /(?=(a)b|c?)()*d/;
shouldBe("regex23.exec('ax')", "null");
var regex24 = /(?=a|b?)c/;
shouldBe("regex24.exec('x')", "null");

View File

@ -0,0 +1,36 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test checks use of the regexp constructor.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS re === RegExp(re) is true
PASS re !== new RegExp(re) is true
PASS re === RegExp(re,'i') is false
PASS re !== new RegExp(re,'i') is true
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,31 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("This test checks use of the regexp constructor.");
var re = /abc/;
shouldBeTrue("re === RegExp(re)");
shouldBeTrue("re !== new RegExp(re)");
shouldBeFalse("re === RegExp(re,'i')");
shouldBeTrue("re !== new RegExp(re,'i')");

View File

@ -0,0 +1,141 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests handling of parentheses subexpressions.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS regexp1.exec('test') is null
PASS regexp1.exec('blah') is ['blah']
PASS regexp1.exec('1blah') is ['1blah']
PASS regexp1.exec('blah1') is ['blah1']
PASS regexp1.exec('blah blah blah') is ['blah blah blah']
PASS regexp1.exec('blah\nsecond') is ['blah']
PASS regexp1.exec('first\nblah') is ['blah']
PASS regexp1.exec('first\nblah\nthird') is ['blah']
PASS regexp1.exec('first\nblah2\nblah3') is ['blah2']
PASS regexp2.exec('test') is null
PASS regexp2.exec('blah') is ['blah']
PASS regexp2.exec('1blah') is ['1blah']
PASS regexp2.exec('blah1') is ['blah1']
PASS regexp2.exec('blah blah blah') is ['blah blah blah']
PASS regexp2.exec('blah\nsecond') is ['blah']
PASS regexp2.exec('first\nblah') is null
PASS regexp2.exec('first\nblah\nthird') is null
PASS regexp2.exec('first\nblah2\nblah3') is null
PASS regexp3.exec('test') is null
PASS regexp3.exec('blah') is ['blah']
PASS regexp3.exec('1blah') is ['1blah']
PASS regexp3.exec('blah1') is ['blah1']
PASS regexp3.exec('blah blah blah') is ['blah blah blah']
PASS regexp3.exec('blah\nsecond') is null
PASS regexp3.exec('first\nblah') is ['blah']
PASS regexp3.exec('first\nblah\nthird') is null
PASS regexp3.exec('first\nblah2\nblah3') is ['blah3']
PASS regexp4.exec('test') is null
PASS regexp4.exec('blah') is ['blah']
PASS regexp4.exec('1blah') is ['1blah']
PASS regexp4.exec('blah1') is ['blah1']
PASS regexp4.exec('blah blah blah') is ['blah blah blah']
PASS regexp4.exec('blah\nsecond') is null
PASS regexp4.exec('first\nblah') is null
PASS regexp4.exec('first\nblah\nthird') is null
PASS regexp4.exec('first\nblah2\nblah3') is null
PASS regexp5.exec('test') is null
PASS regexp5.exec('blah') is ['blah']
PASS regexp5.exec('1blah') is ['1blah']
PASS regexp5.exec('blah1') is ['blah1']
PASS regexp5.exec('blah blah blah') is ['blah blah blah']
PASS regexp5.exec('blah\nsecond') is ['blah']
PASS regexp5.exec('first\nblah') is ['blah']
PASS regexp5.exec('first\nblah\nthird') is ['blah']
PASS regexp5.exec('first\nblah2\nblah3') is ['blah2']
PASS regexp6.exec('test') is null
PASS regexp6.exec('blah') is ['blah']
PASS regexp6.exec('1blah') is ['1blah']
PASS regexp6.exec('blah1') is ['blah']
PASS regexp6.exec('blah blah blah') is ['blah blah blah']
PASS regexp6.exec('blah\nsecond') is ['blah']
PASS regexp6.exec('first\nblah') is ['blah']
PASS regexp6.exec('first\nblah\nthird') is ['blah']
PASS regexp6.exec('first\nblah2\nblah3') is ['blah']
PASS regexp7.exec('test') is null
PASS regexp7.exec('blah') is ['blah']
PASS regexp7.exec('1blah') is ['1blah']
PASS regexp7.exec('blah1') is ['blah1']
PASS regexp7.exec('blah blah blah') is ['blah blah blah']
PASS regexp7.exec('blah\nsecond') is null
PASS regexp7.exec('first\nblah') is null
PASS regexp7.exec('first\nblah\nthird') is null
PASS regexp7.exec('first\nblah2\nblah3') is null
PASS regexp8.exec('test') is null
PASS regexp8.exec('blah') is ['blah','']
PASS regexp8.exec('1blah') is ['1blah','1']
PASS regexp8.exec('blah1') is ['blah1','']
PASS regexp8.exec('blah blah blah') is ['blah blah blah','blah blah ']
PASS regexp8.exec('blah\nsecond') is null
PASS regexp8.exec('first\nblah') is null
PASS regexp8.exec('first\nblah\nthird') is null
PASS regexp8.exec('first\nblah2\nblah3') is null
PASS regexp9.exec('test') is null
PASS regexp9.exec('blah') is ['blah']
PASS regexp9.exec('1blah') is ['1blah']
PASS regexp9.exec('blah1') is ['blah1']
PASS regexp9.exec('blah blah blah') is ['blah blah blah']
PASS regexp9.exec('blah\nsecond') is ['blah']
PASS regexp9.exec('first\nblah') is ['blah']
PASS regexp9.exec('first\nblah\nthird') is ['blah']
PASS regexp9.exec('first\nblah2\nblah3') is ['blah2']
PASS regexp10.exec('test') is null
PASS regexp10.exec('blah') is ['blah']
PASS regexp10.exec('1blah') is ['1blah']
PASS regexp10.exec('blah1') is ['blah1']
PASS regexp10.exec('blah blah blah') is ['blah blah blah']
PASS regexp10.exec('blah\nsecond') is ['blah']
PASS regexp10.exec('first\nblah') is ['blah']
PASS regexp10.exec('first\nblah\nthird') is ['blah']
PASS regexp10.exec('first\nblah2\nblah3') is ['blah2']
PASS regexp11.exec('test') is null
PASS regexp11.exec('blah') is ['blah']
PASS regexp11.exec('1blah') is ['1blah']
PASS regexp11.exec('blah1') is ['blah1']
PASS regexp11.exec('blah blah blah') is ['blah blah blah']
PASS regexp11.exec('blah\nsecond') is null
PASS regexp11.exec('first\nblah') is ['blah']
PASS regexp11.exec('first\nblah\nthird') is null
PASS regexp11.exec('first\nblah2\nblah3') is ['blah3']
PASS regexp12.exec('test') is null
PASS regexp12.exec('blah') is ['blah']
PASS regexp12.exec('1blah') is ['1blah']
PASS regexp12.exec('blah1') is ['blah1']
PASS regexp12.exec('blah blah blah') is ['blah blah blah']
PASS regexp12.exec('blah\nsecond') is null
PASS regexp12.exec('first\nblah') is ['blah']
PASS regexp12.exec('first\nblah\nthird') is null
PASS regexp12.exec('first\nblah2\nblah3') is ['blah3']
PASS regexp13.exec('abc\n123') is ['abc\n123']
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,159 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("This page tests handling of parentheses subexpressions.");
var regexp1 = /.*blah.*/;
shouldBeNull("regexp1.exec('test')");
shouldBe("regexp1.exec('blah')", "['blah']");
shouldBe("regexp1.exec('1blah')", "['1blah']");
shouldBe("regexp1.exec('blah1')", "['blah1']");
shouldBe("regexp1.exec('blah blah blah')", "['blah blah blah']");
shouldBe("regexp1.exec('blah\\nsecond')", "['blah']");
shouldBe("regexp1.exec('first\\nblah')", "['blah']");
shouldBe("regexp1.exec('first\\nblah\\nthird')", "['blah']");
shouldBe("regexp1.exec('first\\nblah2\\nblah3')", "['blah2']");
var regexp2 = /^.*blah.*/;
shouldBeNull("regexp2.exec('test')");
shouldBe("regexp2.exec('blah')", "['blah']");
shouldBe("regexp2.exec('1blah')", "['1blah']");
shouldBe("regexp2.exec('blah1')", "['blah1']");
shouldBe("regexp2.exec('blah blah blah')", "['blah blah blah']");
shouldBe("regexp2.exec('blah\\nsecond')", "['blah']");
shouldBeNull("regexp2.exec('first\\nblah')");
shouldBeNull("regexp2.exec('first\\nblah\\nthird')");
shouldBeNull("regexp2.exec('first\\nblah2\\nblah3')");
var regexp3 = /.*blah.*$/;
shouldBeNull("regexp3.exec('test')");
shouldBe("regexp3.exec('blah')", "['blah']");
shouldBe("regexp3.exec('1blah')", "['1blah']");
shouldBe("regexp3.exec('blah1')", "['blah1']");
shouldBe("regexp3.exec('blah blah blah')", "['blah blah blah']");
shouldBeNull("regexp3.exec('blah\\nsecond')");
shouldBe("regexp3.exec('first\\nblah')", "['blah']");
shouldBeNull("regexp3.exec('first\\nblah\\nthird')");
shouldBe("regexp3.exec('first\\nblah2\\nblah3')", "['blah3']");
var regexp4 = /^.*blah.*$/;
shouldBeNull("regexp4.exec('test')");
shouldBe("regexp4.exec('blah')", "['blah']");
shouldBe("regexp4.exec('1blah')", "['1blah']");
shouldBe("regexp4.exec('blah1')", "['blah1']");
shouldBe("regexp4.exec('blah blah blah')", "['blah blah blah']");
shouldBeNull("regexp4.exec('blah\\nsecond')");
shouldBeNull("regexp4.exec('first\\nblah')");
shouldBeNull("regexp4.exec('first\\nblah\\nthird')");
shouldBeNull("regexp4.exec('first\\nblah2\\nblah3')");
var regexp5 = /.*?blah.*/;
shouldBeNull("regexp5.exec('test')");
shouldBe("regexp5.exec('blah')", "['blah']");
shouldBe("regexp5.exec('1blah')", "['1blah']");
shouldBe("regexp5.exec('blah1')", "['blah1']");
shouldBe("regexp5.exec('blah blah blah')", "['blah blah blah']");
shouldBe("regexp5.exec('blah\\nsecond')", "['blah']");
shouldBe("regexp5.exec('first\\nblah')", "['blah']");
shouldBe("regexp5.exec('first\\nblah\\nthird')", "['blah']");
shouldBe("regexp5.exec('first\\nblah2\\nblah3')", "['blah2']");
var regexp6 = /.*blah.*?/;
shouldBeNull("regexp6.exec('test')");
shouldBe("regexp6.exec('blah')", "['blah']");
shouldBe("regexp6.exec('1blah')", "['1blah']");
shouldBe("regexp6.exec('blah1')", "['blah']");
shouldBe("regexp6.exec('blah blah blah')", "['blah blah blah']");
shouldBe("regexp6.exec('blah\\nsecond')", "['blah']");
shouldBe("regexp6.exec('first\\nblah')", "['blah']");
shouldBe("regexp6.exec('first\\nblah\\nthird')", "['blah']");
shouldBe("regexp6.exec('first\\nblah2\\nblah3')", "['blah']");
var regexp7 = /^.*?blah.*?$/;
shouldBeNull("regexp7.exec('test')");
shouldBe("regexp7.exec('blah')", "['blah']");
shouldBe("regexp7.exec('1blah')", "['1blah']");
shouldBe("regexp7.exec('blah1')", "['blah1']");
shouldBe("regexp7.exec('blah blah blah')", "['blah blah blah']");
shouldBeNull("regexp7.exec('blah\\nsecond')");
shouldBeNull("regexp7.exec('first\\nblah')");
shouldBeNull("regexp7.exec('first\\nblah\\nthird')");
shouldBeNull("regexp7.exec('first\\nblah2\\nblah3')");
var regexp8 = /^(.*)blah.*$/;
shouldBeNull("regexp8.exec('test')");
shouldBe("regexp8.exec('blah')", "['blah','']");
shouldBe("regexp8.exec('1blah')", "['1blah','1']");
shouldBe("regexp8.exec('blah1')", "['blah1','']");
shouldBe("regexp8.exec('blah blah blah')", "['blah blah blah','blah blah ']");
shouldBeNull("regexp8.exec('blah\\nsecond')");
shouldBeNull("regexp8.exec('first\\nblah')");
shouldBeNull("regexp8.exec('first\\nblah\\nthird')");
shouldBeNull("regexp8.exec('first\\nblah2\\nblah3')");
var regexp9 = /.*blah.*/m;
shouldBeNull("regexp9.exec('test')");
shouldBe("regexp9.exec('blah')", "['blah']");
shouldBe("regexp9.exec('1blah')", "['1blah']");
shouldBe("regexp9.exec('blah1')", "['blah1']");
shouldBe("regexp9.exec('blah blah blah')", "['blah blah blah']");
shouldBe("regexp9.exec('blah\\nsecond')", "['blah']");
shouldBe("regexp9.exec('first\\nblah')", "['blah']");
shouldBe("regexp9.exec('first\\nblah\\nthird')", "['blah']");
shouldBe("regexp9.exec('first\\nblah2\\nblah3')", "['blah2']");
var regexp10 = /^.*blah.*/m;
shouldBeNull("regexp10.exec('test')");
shouldBe("regexp10.exec('blah')", "['blah']");
shouldBe("regexp10.exec('1blah')", "['1blah']");
shouldBe("regexp10.exec('blah1')", "['blah1']");
shouldBe("regexp10.exec('blah blah blah')", "['blah blah blah']");
shouldBe("regexp10.exec('blah\\nsecond')", "['blah']");
shouldBe("regexp10.exec('first\\nblah')", "['blah']");
shouldBe("regexp10.exec('first\\nblah\\nthird')", "['blah']");
shouldBe("regexp10.exec('first\\nblah2\\nblah3')", "['blah2']");
var regexp11 = /.*(?:blah).*$/;
shouldBeNull("regexp11.exec('test')");
shouldBe("regexp11.exec('blah')", "['blah']");
shouldBe("regexp11.exec('1blah')", "['1blah']");
shouldBe("regexp11.exec('blah1')", "['blah1']");
shouldBe("regexp11.exec('blah blah blah')", "['blah blah blah']");
shouldBeNull("regexp11.exec('blah\\nsecond')");
shouldBe("regexp11.exec('first\\nblah')", "['blah']");
shouldBeNull("regexp11.exec('first\\nblah\\nthird')");
shouldBe("regexp11.exec('first\\nblah2\\nblah3')", "['blah3']");
var regexp12 = /.*(?:blah|buzz|bang).*$/;
shouldBeNull("regexp12.exec('test')");
shouldBe("regexp12.exec('blah')", "['blah']");
shouldBe("regexp12.exec('1blah')", "['1blah']");
shouldBe("regexp12.exec('blah1')", "['blah1']");
shouldBe("regexp12.exec('blah blah blah')", "['blah blah blah']");
shouldBeNull("regexp12.exec('blah\\nsecond')");
shouldBe("regexp12.exec('first\\nblah')", "['blah']");
shouldBeNull("regexp12.exec('first\\nblah\\nthird')");
shouldBe("regexp12.exec('first\\nblah2\\nblah3')", "['blah3']");
var regexp13 = /.*\n\d+.*/;
shouldBe("regexp13.exec('abc\\n123')", "['abc\\n123']");

View File

@ -0,0 +1,35 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Test that covers capturing brackets, and was adapted from a part of an early version of Acid3.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS /TA[])]/.exec('TA]') threw exception SyntaxError: Invalid regular expression: /TA[])]/: Unmatched ')'.
PASS /[]/.exec('') is null
PASS /(\3)(\1)(a)/.exec('cat').toString() is 'a,,,a'
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,33 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'Test that covers capturing brackets, and was adapted from a part of an early version of Acid3.'
);
// JS regexps aren't like Perl regexps, if their character
// classes start with a ] that means they're empty. So this
// is a syntax error; if we get here it's a bug.
shouldThrow("/TA[])]/.exec('TA]')");
shouldBe("/[]/.exec('')", "null");
shouldBe("/(\\3)(\\1)(a)/.exec('cat').toString()", "'a,,,a'");

View File

@ -0,0 +1,44 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests the regex examples from the ECMA-262 specification.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS regex01.exec("abc") is ["a"]
PASS regex02.exec("abc") is ["abc", "a", "a", undefined, "bc", undefined, "bc"]
PASS regex03.exec("abcdefghi") is ["abcde"]
PASS regex04.exec("abcdefghi") is ["abc"]
PASS regex05.exec("aabaac") is ["aaba", "ba"]
PASS "aaaaaaaaaa,aaaaaaaaaaaaaaa".replace(regex06,"$1") is "aaaaa"
PASS regex07.exec("zaacbbbcac") is ["zaacbbbcac", "z", "ac", "a", undefined, "c"]
PASS regex08.exec("b") is ["", undefined]
PASS regex09.exec("baaaac") is ["b", ""]
PASS regex10.exec("baaabac") is ["", "aaa"]
PASS regex11.exec("baaabac") is ["aba", "a"]
PASS regex12.exec("baaabaac") is ["baaabaac", "ba", undefined, "abaac"]
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,62 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"This page tests the regex examples from the ECMA-262 specification."
);
var regex01 = /a|ab/;
shouldBe('regex01.exec("abc")', '["a"]');
var regex02 = /((a)|(ab))((c)|(bc))/;
shouldBe('regex02.exec("abc")', '["abc", "a", "a", undefined, "bc", undefined, "bc"]');
var regex03 = /a[a-z]{2,4}/;
shouldBe('regex03.exec("abcdefghi")', '["abcde"]');
var regex04 = /a[a-z]{2,4}?/;
shouldBe('regex04.exec("abcdefghi")', '["abc"]');
var regex05 = /(aa|aabaac|ba|b|c)*/;
shouldBe('regex05.exec("aabaac")', '["aaba", "ba"]');
var regex06 = /^(a+)\1*,\1+$/;
shouldBe('"aaaaaaaaaa,aaaaaaaaaaaaaaa".replace(regex06,"$1")', '"aaaaa"');
var regex07 = /(z)((a+)?(b+)?(c))*/;
shouldBe('regex07.exec("zaacbbbcac")', '["zaacbbbcac", "z", "ac", "a", undefined, "c"]');
var regex08 = /(a*)*/;
shouldBe('regex08.exec("b")', '["", undefined]');
var regex09 = /(a*)b\1+/;
shouldBe('regex09.exec("baaaac")', '["b", ""]');
var regex10 = /(?=(a+))/;
shouldBe('regex10.exec("baaabac")', '["", "aaa"]');
var regex11 = /(?=(a+))a*b\1/;
shouldBe('regex11.exec("baaabac")', '["aba", "a"]');
var regex12 = /(.*?)a(?!(a+)b\2c)\2(.*)/;
shouldBe('regex12.exec("baaabaac")', '["baaabaac", "ba", undefined, "abaac"]');

View File

@ -0,0 +1,43 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests invalid character ranges in character classes.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS /[a-c]+/.exec("-acbd"); is ["acb"]
PASS /[a\-c]+/.exec("-acbd") is ["-ac"]
PASS /[c-a]+/.exec("-acbd"); threw exception SyntaxError: Invalid regular expression: /[c-a]+/: Range out of order in character class.
PASS /[\d-x]+/.exec("1-3xy"); is ["1-3x"]
PASS /[x-\d]+/.exec("1-3xy"); is ["1-3x"]
PASS /[\d-\d]+/.exec("1-3xy"); is ["1-3"]
PASS /[\d-a-z]+/.exec("az1-3y"); is ["az1-3"]
PASS /[\d\-x]+/.exec("1-3xy"); is ["1-3x"]
PASS /[x\-\d]+/.exec("1-3xy"); is ["1-3x"]
PASS /[\d\-\d]+/.exec("1-3xy"); is ["1-3"]
PASS /[\d-]+/.exec("1-3xy") is ["1-3"]
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,50 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"This page tests invalid character ranges in character classes."
);
// These test a basic range / non range.
shouldBe('/[a-c]+/.exec("-acbd");', '["acb"]');
shouldBe('/[a\\-c]+/.exec("-acbd")', '["-ac"]');
// A reverse-range is invalid.
shouldThrow('/[c-a]+/.exec("-acbd");');
// A character-class in a range is invalid, according to ECMA-262, but we allow it.
shouldBe('/[\\d-x]+/.exec("1-3xy");', '["1-3x"]');
shouldBe('/[x-\\d]+/.exec("1-3xy");', '["1-3x"]');
shouldBe('/[\\d-\\d]+/.exec("1-3xy");', '["1-3"]');
// Whilst we break with ECMA-262's definition of CharacterRange, we do comply with
// the grammar, and as such in the following regex a-z cannot be matched as a range.
shouldBe('/[\\d-a-z]+/.exec("az1-3y");', '["az1-3"]');
// An escaped hypen should not be confused for an invalid range.
shouldBe('/[\\d\\-x]+/.exec("1-3xy");', '["1-3x"]');
shouldBe('/[x\\-\\d]+/.exec("1-3xy");', '["1-3x"]');
shouldBe('/[\\d\\-\\d]+/.exec("1-3xy");', '["1-3"]');
// A hyphen after a character-class is not invalid.
shouldBe('/[\\d-]+/.exec("1-3xy")', '["1-3"]');

View File

@ -0,0 +1,53 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests that a RegExp object's lastIndex behaves like a regular property.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS delete /x/.lastIndex is false
PASS 'use strict'; delete /x/.lastIndex threw exception TypeError: Cannot delete property 'lastIndex' of [object RegExp].
PASS 'lastIndex' in /x/ is true
PASS for (property in /x/) if (property === 'lastIndex') throw false; true is true
PASS var re = /x/; re.lastIndex = re; re.lastIndex === re is true
PASS Object.defineProperty(/x/, {get:function(){}}) threw exception TypeError: Property description must be an object: undefined.
PASS Object.defineProperty(/x/, 'lastIndex', {enumerable:true}); true threw exception TypeError: Cannot redefine property: lastIndex.
PASS Object.defineProperty(/x/, 'lastIndex', {enumerable:false}); true is true
PASS Object.defineProperty(/x/, 'lastIndex', {configurable:true}); true threw exception TypeError: Cannot redefine property: lastIndex.
PASS Object.defineProperty(/x/, 'lastIndex', {configurable:false}); true is true
PASS var re = Object.defineProperty(/x/, 'lastIndex', {writable:true}); re.lastIndex = 42; re.lastIndex is 42
PASS var re = Object.defineProperty(/x/, 'lastIndex', {writable:false}); re.lastIndex = 42; re.lastIndex is 0
PASS var re = Object.defineProperty(/x/, 'lastIndex', {value:42}); re.lastIndex is 42
PASS Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {writable:true}); true threw exception TypeError: Cannot redefine property: lastIndex.
PASS Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {value:42}); true threw exception TypeError: Cannot redefine property: lastIndex.
PASS Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {value:0}); true is true
PASS Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('') is null
PASS Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('x') is ["x"]
PASS Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('') threw exception TypeError: Cannot assign to read only property 'lastIndex' of object '[object RegExp]'.
PASS Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('x') threw exception TypeError: Cannot assign to read only property 'lastIndex' of object '[object RegExp]'.
PASS var re = /x/; Object.freeze(re); Object.isFrozen(re); is true
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,71 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"This page tests that a RegExp object's lastIndex behaves like a regular property."
);
// lastIndex is not configurable
shouldBeFalse("delete /x/.lastIndex");
shouldThrow("'use strict'; delete /x/.lastIndex");
// lastIndex is not enumerable
shouldBeTrue("'lastIndex' in /x/");
shouldBeTrue("for (property in /x/) if (property === 'lastIndex') throw false; true");
// lastIndex is writable
shouldBeTrue("var re = /x/; re.lastIndex = re; re.lastIndex === re");
// Cannot redefine lastIndex as an accessor
shouldThrow("Object.defineProperty(/x/, {get:function(){}})");
// Cannot redefine lastIndex as enumerable
shouldThrow("Object.defineProperty(/x/, 'lastIndex', {enumerable:true}); true");
shouldBeTrue("Object.defineProperty(/x/, 'lastIndex', {enumerable:false}); true");
// Cannot redefine lastIndex as configurable
shouldThrow("Object.defineProperty(/x/, 'lastIndex', {configurable:true}); true");
shouldBeTrue("Object.defineProperty(/x/, 'lastIndex', {configurable:false}); true");
// Can redefine lastIndex as read-only
shouldBe("var re = Object.defineProperty(/x/, 'lastIndex', {writable:true}); re.lastIndex = 42; re.lastIndex", '42');
shouldBe("var re = Object.defineProperty(/x/, 'lastIndex', {writable:false}); re.lastIndex = 42; re.lastIndex", '0');
// Can redefine the value
shouldBe("var re = Object.defineProperty(/x/, 'lastIndex', {value:42}); re.lastIndex", '42');
// Cannot redefine read-only lastIndex as writable
shouldThrow("Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {writable:true}); true");
// Can only redefine the value of a read-only lastIndex as the current value
shouldThrow("Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {value:42}); true");
shouldBeTrue("Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {value:0}); true");
// Trying to run a global regular expression should throw, if lastIndex is read-only
shouldBe("Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('')", 'null');
shouldBe("Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('x')", '["x"]');
shouldThrow("Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('')");
shouldThrow("Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('x')");
// Should be able to freeze a regular expression object.
shouldBeTrue("var re = /x/; Object.freeze(re); Object.isFrozen(re);");

View File

@ -0,0 +1,65 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests handling of malformed escape sequences.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Testing regexp: /\ug/gm
PASS regexp.test('ug') is true
PASS regexp.lastIndex is 2
Testing regexp: /\xg/gm
PASS regexp.test('xg') is true
PASS regexp.lastIndex is 2
Testing regexp: /\c_/gm
PASS regexp.test('\\c_') is true
PASS regexp.lastIndex is 3
Testing regexp: /[\B]/gm
PASS regexp.test('B') is true
PASS regexp.lastIndex is 1
Testing regexp: /[\b]/gm
PASS regexp.test('\b') is true
PASS regexp.lastIndex is 1
Testing regexp: /\8/gm
PASS regexp.test('\\8') is true
PASS regexp.lastIndex is 2
Testing regexp: /^[\c]$/
PASS regexp.test('c') is true
Testing regexp: /^[\c_]$/
PASS regexp.test('c') is false
Testing regexp: /^[\c]]$/
PASS regexp.test('c]') is true
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,70 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"This page tests handling of malformed escape sequences."
);
var regexp;
regexp = /\ug/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('ug')");
shouldBe("regexp.lastIndex", "2");
regexp = /\xg/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('xg')");
shouldBe("regexp.lastIndex", "2");
regexp = /\c_/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('\\\\c_')");
shouldBe("regexp.lastIndex", "3");
regexp = /[\B]/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('B')");
shouldBe("regexp.lastIndex", "1");
regexp = /[\b]/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('\\b')");
shouldBe("regexp.lastIndex", "1");
regexp = /\8/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('\\\\8')");
shouldBe("regexp.lastIndex", "2");
regexp = /^[\c]$/;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('c')");
regexp = /^[\c_]$/;
debug("\nTesting regexp: " + regexp);
shouldBeFalse("regexp.test('c')");
regexp = /^[\c]]$/;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('c]')");

View File

@ -0,0 +1,33 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests for proper backtracking with greedy quantifiers and non-capturing parentheses.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS re.exec('a') is ['a']
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,29 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"This page tests for proper backtracking with greedy quantifiers and non-capturing parentheses."
);
var re = /(?:a*)a/;
shouldBe("re.exec('a')", "['a']");

View File

@ -0,0 +1,36 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test checks expressions with alternative lengths of appox. 2^31.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS regexp1.exec('') is null
PASS regexp2.exec('') is null
PASS regexp3.exec(s3) is null
FAIL function f() { /[^a$]{4294967295}/ } should throw SyntaxError: Invalid regular expression: number too large in {} quantifier. Was undefined.
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,36 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("This test checks expressions with alternative lengths of appox. 2^31.");
var regexp1 = /(?:(?=g))|(?:m).{2147483648,}/;
shouldBe("regexp1.exec('')", 'null');
var regexp2 = /(?:(?=g)).{2147483648,}/;
shouldBe("regexp2.exec('')", 'null');
var s3 = "&{6}u4a64YfQP{C}u88c4u5772Qu8693{4294967167}u85f2u7f3fs((uf202){4})u5bc6u1947";
var regexp3 = new RegExp(s3, "");
shouldBe("regexp3.exec(s3)", 'null');
shouldThrow("function f() { /[^a$]{4294967295}/ }", '"SyntaxError: Invalid regular expression: number too large in {} quantifier"');

View File

@ -0,0 +1,124 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests handling of parentheses subexpressions.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS regexp1.exec('abc') is ['ab','a','b']
PASS regexp2.exec('abacadabe') is ['abe','ab','b','b']
PASS regexp3.exec('abacadabe') is ['abe','ab','b',undefined]
PASS regexp4.exec('abacadabe') is ['abe','ab','b',undefined]
PASS regexp5.exec('abacadabe') is ['abe','ab','b','b',undefined,undefined]
PASS regexp6.exec('abcde') is ['ab','ab','b','b',undefined,undefined]
PASS regexp7.exec('abc') is ['abc','ab','b']
PASS regexp8.exec('bcaddxqy') is ['qy','q','q','y']
PASS regexp9.exec('asdfjejgsdflaksdfjkeljghkjea') is ['a','a',undefined]
PASS regexp10.exec('asdfjejgsdflaksdfjkeljghat') is ['at']
PASS regexp11.exec('Developing with JavaScript is dangerous, do not try it without assistance') is null
PASS regexp12.exec('Seattle, WA to Buckley, WA') is ['Seattle, WA to Buckley, WA', undefined, 'Seattle', 'WA', undefined, 'Buckley', 'WA']
PASS regexp13.exec('zxcasd;fl ^AaaAAaaaf;lrlrzs') is ['AaaAAaaaf;lrlrzs',undefined,'AaaAAaaaf;lrlrzs']
PASS regexp14.exec('b') is ['b',undefined,'b']
PASS regexp15.exec('abdf') is ['abdf',undefined,'abd','f']
PASS regexp16.exec('abc') is ['ab','a','b']
PASS regexp17.exec('bcaDxqy') is ['Dx','D']
PASS regexp18.exec('Hello: World') is ['Hello:',':']
PASS regexp19.exec('barrel') is ['bar','']
PASS regexp20.exec('barrel') is ['barrel','rel']
PASS regexp20.exec('2barrel') is ['2barrel','rel']
PASS regexp21.exec('abc') is ['ab','ab','b']
PASS regexp22.exec('abcdlskfgjdslkfg') is null
PASS regexp23.exec('<html xmlns="http://www.w3.org/1999/xhtml"') is ['"http://www.w3.org/1999/xhtml"']
PASS regexp24.exec('123') is null
PASS regexp25.exec('this is a test') is ['this','this',undefined]
PASS regexp25.exec('!this is a test') is null
PASS regexp26.exec('aaa') is ['aaa',undefined,undefined]
PASS regexp27.exec('file:///Users/Someone/Desktop/HelloWorld/index.html') is ['file:///Users/Someone/Desktop/HelloWorld/index.html','file','//','',undefined,undefined,undefined,'',undefined,'/Users/Someone/Desktop/HelloWorld/index.html',undefined,undefined]
PASS regexp28.exec('file:///Users/Someone/Desktop/HelloWorld/index.html') is ['file:','file',undefined,undefined,undefined,undefined,undefined]
PASS regexp29.exec('Committer:') is null
PASS regexp30.exec('Committer:') is null
PASS regexp31.exec('Committer:') is null
PASS regexp32.exec('Committer:') is null
PASS regexp33.exec('> <head>') is ['>',undefined,undefined,'>']
PASS regexp34.exec('xyz123') is null
PASS regexp34.exec('btn-abc') is ['btn-abc']
PASS regexp34.exec('btn- abc') is null
PASS regexp34.exec('XXbtn-abc') is null
PASS regexp34.exec('XX btn-abc') is ['btn-abc']
PASS regexp35.exec('ax') is ['ax','ax','a','x']
PASS regexp35.exec('axx') is null
PASS regexp35.exec('axxx') is ['axxx','axxx','a','xxx']
PASS regexp35.exec('bx') is ['bx','bx','b','x']
PASS regexp35.exec('bxx') is null
PASS regexp35.exec('bxxx') is ['bxxx','bxxx','b','xxx']
PASS regexp36.exec('/2011') is ['/2011','/2011','/','2011']
PASS regexp36.exec('/11') is ['/11','/11','/','11']
PASS regexp36.exec('/123') is null
PASS regexp37.exec('7/4/1776') is ['7/4/1776','7','/','4','/1776','/','1776']
PASS regexp37.exec('07-04-1776') is ['07-04-1776','07','-','04','-1776','-','1776']
PASS regexp38.exec('xx') is ['xx','xx','xx']
PASS regexp38.exec('b') is ['b','b',undefined]
PASS regexp38.exec('z') is ['z','z',undefined]
PASS regexp38.exec('') is ['','',undefined]
PASS regexp39.exec('') is ['',undefined,undefined]
PASS regexp39.exec('8') is ['8','8',undefined]
PASS regexp39.exec('zP') is ['',undefined,undefined]
PASS regexp40.exec('') is ['',undefined,undefined,undefined,'']
PASS regexp40.exec('8') is ['8','8','8',undefined,'']
PASS regexp40.exec('zPz') is ['',undefined,undefined,undefined,'']
PASS regexp40.exec('zPPz') is ['',undefined,undefined,undefined,'']
PASS regexp40.exec('zPPPz') is ['',undefined,undefined,undefined,'']
PASS regexp40.exec('zPPPPz') is ['',undefined,undefined,undefined,'']
PASS regexp41.exec('Here is a link: http://www.acme.com/our_products/index.html. That is all we want!') is ['http://www.acme.com/our_products/index.html','http://www.acme.com/our_products/index.html','http://','l',undefined]
PASS regexp42.exec('') is ['',undefined,undefined]
PASS regexp42.exec('4') is ['4','4','4']
PASS regexp42.exec('4321') is ['4','4','4']
PASS /(?!(?=r{0}){2,})|((z)?)?/gi.test('') is true
PASS regexp43.exec('SSS') is ['']
PASS regexp44.exec('SSS') is ['',undefined]
PASS regexp45.exec('vt') is null
PASS regexp46.exec('5') is null
PASS regexp46.exec('pk') is ['pk',undefined,undefined]
PASS regexp46.exec('Xw555') is ['w555','w',undefined]
PASS regexp46.exec('Xw55pk5') is ['w','w','']
PASS regexp47.exec('/www.acme.com/this/is/a/path/file.txt') is ['/www.acme.com/this/is/a/path/file.txt','/www.acme.com/this/is/a/path/file.txt',undefined]
PASS regexp48.exec('http://www.acme.com/this/is/a/path/file.txt') is ['http://www.acme.com/this/is/a/path/file.txt','http','www.acme.com',undefined,'this/is/a/path/file.txt',undefined,undefined]
PASS regexp49.exec('http://www.acme.com/this/is/a/path/file.txt') is ['http://www.acme.com/this/is/a/path/file.txt',undefined,undefined,'http','www.acme.com',undefined,'this/is/a/path/file.txt',undefined,undefined]
PASS regexp50.exec('((a)b{28,}c|d)x') is null
PASS regexp50.exec('abbbbbbbbbbbbbbbbbbbbbbbbbbbbcx') is ['abbbbbbbbbbbbbbbbbbbbbbbbbbbbcx', 'abbbbbbbbbbbbbbbbbbbbbbbbbbbbc', 'a']
PASS regexp50.exec('dx') is ['dx', 'd', undefined]
PASS regexp51.exec('abc') is null
PASS regexp51.exec(s) is [')ž{-,}P{Any}',')',undefined]
PASS 'Hi Bob'.match(regexp52) is ['Bob',undefined,'Bob',undefined,undefined]
PASS regexp53.exec('#') is ['',undefined,'']
PASS regexp54.exec('#') is ['','',undefined,undefined,'']
PASS regexp55.exec('#') is ['','']
PASS regexp56.exec('a') is ['','']
PASS regexp57.exec('a') is ['a','a']
PASS regexp58.exec('badbc') is ['a']
PASS 'Y aaa X Match1 Y aaa Y Match2 Z'.match(regexp59) is ['X Match1 Y','Y Match2 Z']
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,276 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("This page tests handling of parentheses subexpressions.");
var regexp1 = /(a|A)(b|B)/;
shouldBe("regexp1.exec('abc')", "['ab','a','b']");
var regexp2 = /(a((b)|c|d))e/;
shouldBe("regexp2.exec('abacadabe')", "['abe','ab','b','b']");
var regexp3 = /(a(b|(c)|d))e/;
shouldBe("regexp3.exec('abacadabe')", "['abe','ab','b',undefined]");
var regexp4 = /(a(b|c|(d)))e/;
shouldBe("regexp4.exec('abacadabe')", "['abe','ab','b',undefined]");
var regexp5 = /(a((b)|(c)|(d)))e/;
shouldBe("regexp5.exec('abacadabe')", "['abe','ab','b','b',undefined,undefined]");
var regexp6 = /(a((b)|(c)|(d)))/;
shouldBe("regexp6.exec('abcde')", "['ab','ab','b','b',undefined,undefined]");
var regexp7 = /(a(b)??)??c/;
shouldBe("regexp7.exec('abc')", "['abc','ab','b']");
var regexp8 = /(a|(e|q))(x|y)/;
shouldBe("regexp8.exec('bcaddxqy')" , "['qy','q','q','y']");
var regexp9 = /((t|b)?|a)$/;
shouldBe("regexp9.exec('asdfjejgsdflaksdfjkeljghkjea')", "['a','a',undefined]");
var regexp10 = /(?:h|e?(?:t|b)?|a?(?:t|b)?)(?:$)/;
shouldBe("regexp10.exec('asdfjejgsdflaksdfjkeljghat')", "['at']");
var regexp11 = /([Jj]ava([Ss]cript)?)\sis\s(fun\w*)/;
shouldBeNull("regexp11.exec('Developing with JavaScript is dangerous, do not try it without assistance')");
var regexp12 = /(?:(.+), )?(.+), (..) to (?:(.+), )?(.+), (..)/;
shouldBe("regexp12.exec('Seattle, WA to Buckley, WA')", "['Seattle, WA to Buckley, WA', undefined, 'Seattle', 'WA', undefined, 'Buckley', 'WA']");
var regexp13 = /(A)?(A.*)/;
shouldBe("regexp13.exec('zxcasd;fl\ ^AaaAAaaaf;lrlrzs')", "['AaaAAaaaf;lrlrzs',undefined,'AaaAAaaaf;lrlrzs']");
var regexp14 = /(a)|(b)/;
shouldBe("regexp14.exec('b')", "['b',undefined,'b']");
var regexp15 = /^(?!(ab)de|x)(abd)(f)/;
shouldBe("regexp15.exec('abdf')", "['abdf',undefined,'abd','f']");
var regexp16 = /(a|A)(b|B)/;
shouldBe("regexp16.exec('abc')", "['ab','a','b']");
var regexp17 = /(a|d|q|)x/i;
shouldBe("regexp17.exec('bcaDxqy')", "['Dx','D']");
var regexp18 = /^.*?(:|$)/;
shouldBe("regexp18.exec('Hello: World')", "['Hello:',':']");
var regexp19 = /(ab|^.{0,2})bar/;
shouldBe("regexp19.exec('barrel')", "['bar','']");
var regexp20 = /(?:(?!foo)...|^.{0,2})bar(.*)/;
shouldBe("regexp20.exec('barrel')", "['barrel','rel']");
shouldBe("regexp20.exec('2barrel')", "['2barrel','rel']");
var regexp21 = /([a-g](b|B)|xyz)/;
shouldBe("regexp21.exec('abc')", "['ab','ab','b']");
var regexp22 = /(?:^|;)\s*abc=([^;]*)/;
shouldBeNull("regexp22.exec('abcdlskfgjdslkfg')");
var regexp23 = /"[^<"]*"|'[^<']*'/;
shouldBe("regexp23.exec('<html xmlns=\"http://www.w3.org/1999/xhtml\"')", "['\"http://www.w3.org/1999/xhtml\"']");
var regexp24 = /^(?:(?=abc)\w{3}:|\d\d)$/;
shouldBeNull("regexp24.exec('123')");
var regexp25 = /^\s*(\*|[\w\-]+)(\b|$)?/;
shouldBe("regexp25.exec('this is a test')", "['this','this',undefined]");
shouldBeNull("regexp25.exec('!this is a test')");
var regexp26 = /a(b)(a*)|aaa/;
shouldBe("regexp26.exec('aaa')", "['aaa',undefined,undefined]");
var regexp27 = new RegExp(
"^" +
"(?:" +
"([^:/?#]+):" + /* scheme */
")?" +
"(?:" +
"(//)" + /* authorityRoot */
"(" + /* authority */
"(?:" +
"(" + /* userInfo */
"([^:@]*)" + /* user */
":?" +
"([^:@]*)" + /* password */
")?" +
"@" +
")?" +
"([^:/?#]*)" + /* domain */
"(?::(\\d*))?" + /* port */
")" +
")?" +
"([^?#]*)" + /*path*/
"(?:\\?([^#]*))?" + /* queryString */
"(?:#(.*))?" /*fragment */
);
shouldBe("regexp27.exec('file:///Users/Someone/Desktop/HelloWorld/index.html')", "['file:///Users/Someone/Desktop/HelloWorld/index.html','file','//','',undefined,undefined,undefined,'',undefined,'/Users/Someone/Desktop/HelloWorld/index.html',undefined,undefined]");
var regexp28 = new RegExp(
"^" +
"(?:" +
"([^:/?#]+):" + /* scheme */
")?" +
"(?:" +
"(//)" + /* authorityRoot */
"(" + /* authority */
"(" + /* userInfo */
"([^:@]*)" + /* user */
":?" +
"([^:@]*)" + /* password */
")?" +
"@" +
")" +
")?"
);
shouldBe("regexp28.exec('file:///Users/Someone/Desktop/HelloWorld/index.html')", "['file:','file',undefined,undefined,undefined,undefined,undefined]");
var regexp29 = /^\s*((\[[^\]]+\])|(u?)("[^"]+"))\s*/;
shouldBeNull("regexp29.exec('Committer:')");
var regexp30 = /^\s*((\[[^\]]+\])|m(u?)("[^"]+"))\s*/;
shouldBeNull("regexp30.exec('Committer:')");
var regexp31 = /^\s*(m(\[[^\]]+\])|m(u?)("[^"]+"))\s*/;
shouldBeNull("regexp31.exec('Committer:')");
var regexp32 = /\s*(m(\[[^\]]+\])|m(u?)("[^"]+"))\s*/;
shouldBeNull("regexp32.exec('Committer:')");
var regexp33 = RegExp('^(?:(?:(a)(xyz|[^>"\'\s]*)?)|(/?>)|.[^\w\s>]*)');
shouldBe("regexp33.exec('> <head>')","['>',undefined,undefined,'>']");
var regexp34 = /(?:^|\b)btn-\S+/;
shouldBeNull("regexp34.exec('xyz123')");
shouldBe("regexp34.exec('btn-abc')","['btn-abc']");
shouldBeNull("regexp34.exec('btn- abc')");
shouldBeNull("regexp34.exec('XXbtn-abc')");
shouldBe("regexp34.exec('XX btn-abc')","['btn-abc']");
var regexp35 = /^((a|b)(x|xxx)|)$/;
shouldBe("regexp35.exec('ax')", "['ax','ax','a','x']");
shouldBeNull("regexp35.exec('axx')");
shouldBe("regexp35.exec('axxx')", "['axxx','axxx','a','xxx']");
shouldBe("regexp35.exec('bx')", "['bx','bx','b','x']");
shouldBeNull("regexp35.exec('bxx')");
shouldBe("regexp35.exec('bxxx')", "['bxxx','bxxx','b','xxx']");
var regexp36 = /^((\/|\.|\-)(\d\d|\d\d\d\d)|)$/;
shouldBe("regexp36.exec('/2011')", "['/2011','/2011','/','2011']");
shouldBe("regexp36.exec('/11')", "['/11','/11','/','11']");
shouldBeNull("regexp36.exec('/123')");
var regexp37 = /^([1][0-2]|[0]\d|\d)(\/|\.|\-)([0-2]\d|[3][0-1]|\d)((\/|\.|\-)(\d\d|\d\d\d\d)|)$/;
shouldBe("regexp37.exec('7/4/1776')", "['7/4/1776','7','/','4','/1776','/','1776']");
shouldBe("regexp37.exec('07-04-1776')", "['07-04-1776','07','-','04','-1776','-','1776']");
var regexp38 = /^(z|(x|xx)|b|)$/;
shouldBe("regexp38.exec('xx')", "['xx','xx','xx']");
shouldBe("regexp38.exec('b')", "['b','b',undefined]");
shouldBe("regexp38.exec('z')", "['z','z',undefined]");
shouldBe("regexp38.exec('')", "['','',undefined]");
var regexp39 = /(8|((?=P)))?/;
shouldBe("regexp39.exec('')", "['',undefined,undefined]");
shouldBe("regexp39.exec('8')", "['8','8',undefined]");
shouldBe("regexp39.exec('zP')", "['',undefined,undefined]");
var regexp40 = /((8)|((?=P){4}))?()/;
shouldBe("regexp40.exec('')", "['',undefined,undefined,undefined,'']");
shouldBe("regexp40.exec('8')", "['8','8','8',undefined,'']");
shouldBe("regexp40.exec('zPz')", "['',undefined,undefined,undefined,'']");
shouldBe("regexp40.exec('zPPz')", "['',undefined,undefined,undefined,'']");
shouldBe("regexp40.exec('zPPPz')", "['',undefined,undefined,undefined,'']");
shouldBe("regexp40.exec('zPPPPz')", "['',undefined,undefined,undefined,'']");
var regexp41 = /(([\w\-]+:\/\/?|www[.])[^\s()<>]+(?:([\w\d]+)|([^\[:punct:\]\s()<>\W]|\/)))/;
shouldBe("regexp41.exec('Here is a link: http://www.acme.com/our_products/index.html. That is all we want!')", "['http://www.acme.com/our_products/index.html','http://www.acme.com/our_products/index.html','http://','l',undefined]");
var regexp42 = /((?:(4)?))?/;
shouldBe("regexp42.exec('')", "['',undefined,undefined]");
shouldBe("regexp42.exec('4')", "['4','4','4']");
shouldBe("regexp42.exec('4321')", "['4','4','4']");
shouldBeTrue("/(?!(?=r{0}){2,})|((z)?)?/gi.test('')");
var regexp43 = /(?!(?:\1+s))/;
shouldBe("regexp43.exec('SSS')", "['']");
var regexp44 = /(?!(?:\3+(s+?)))/g;
shouldBe("regexp44.exec('SSS')", "['',undefined]");
var regexp45 = /((?!(?:|)v{2,}|))/;
shouldBeNull("regexp45.exec('vt')");
var regexp46 = /(w)(?:5{3}|())|pk/;
shouldBeNull("regexp46.exec('5')");
shouldBe("regexp46.exec('pk')", "['pk',undefined,undefined]");
shouldBe("regexp46.exec('Xw555')", "['w555','w',undefined]");
shouldBe("regexp46.exec('Xw55pk5')", "['w','w','']");
var regexp47 = /(.*?)(?:(?:\?(.*?)?)?)(?:(?:#)?)$/;
shouldBe("regexp47.exec('/www.acme.com/this/is/a/path/file.txt')", "['/www.acme.com/this/is/a/path/file.txt','/www.acme.com/this/is/a/path/file.txt',undefined]");
var regexp48 = /^(?:(\w+):\/*([\w\.\-\d]+)(?::(\d+)|)(?=(?:\/|$))|)(?:$|\/?(.*?)(?:\?(.*?)?|)(?:#(.*)|)$)/;
/* The regexp on the prior line confuses Xcode syntax highlighting, this coment fixes it! */
shouldBe("regexp48.exec('http://www.acme.com/this/is/a/path/file.txt')", "['http://www.acme.com/this/is/a/path/file.txt','http','www.acme.com',undefined,'this/is/a/path/file.txt',undefined,undefined]");
var regexp49 = /(?:([^:]*?)(?:(?:\?(.*?)?)?)(?:(?:#)?)$)|(?:^(?:(\w+):\/*([\w\.\-\d]+)(?::(\d+)|)(?=(?:\/|$))|)(?:$|\/?(.*?)(?:\?(.*?)?|)(?:#(.*)|)$))/;
/* The regexp on the prior line confuses Xcode syntax highlighting, this coment fixes it! */
shouldBe("regexp49.exec('http://www.acme.com/this/is/a/path/file.txt')", "['http://www.acme.com/this/is/a/path/file.txt',undefined,undefined,'http','www.acme.com',undefined,'this/is/a/path/file.txt',undefined,undefined]");
var regexp50 = /((a)b{28,}c|d)x/;
shouldBeNull("regexp50.exec('((a)b{28,}c|d)x')");
shouldBe("regexp50.exec('abbbbbbbbbbbbbbbbbbbbbbbbbbbbcx')", "['abbbbbbbbbbbbbbbbbbbbbbbbbbbbcx', 'abbbbbbbbbbbbbbbbbbbbbbbbbbbbc', 'a']");
shouldBe("regexp50.exec('dx')", "['dx', 'd', undefined]");
var s = "((.\s{-}).{28,}\P{Yi}?{,30}\|.)\x9e{-,}\P{Any}";
var regexp51 = new RegExp(s);
shouldBeNull("regexp51.exec('abc')");
shouldBe("regexp51.exec(s)", "[')\x9e{-,}P{Any}',')',undefined]");
var regexp52 = /(Rob)|(Bob)|(Robert)|(Bobby)/;
shouldBe("'Hi Bob'.match(regexp52)", "['Bob',undefined,'Bob',undefined,undefined]");
// Test cases discovered by fuzzing that crashed the compiler.
var regexp53 = /(?=(?:(?:(gB)|(?!cs|<))((?=(?!v6){0,})))|(?=#)+?)/m;
shouldBe("regexp53.exec('#')", "['',undefined,'']");
var regexp54 = /((?:(?:()|(?!))((?=(?!))))|())/m;
shouldBe("regexp54.exec('#')", "['','',undefined,undefined,'']");
var regexp55 = /(?:(?:(?:a?|(?:))((?:)))|a?)/m;
shouldBe("regexp55.exec('#')", "['','']");
// Test evaluation order of empty subpattern alternatives.
var regexp56 = /(|a)/;
shouldBe("regexp56.exec('a')", "['','']");
var regexp57 = /(a|)/;
shouldBe("regexp57.exec('a')", "['a','a']");
// Tests that non-greedy repeat quantified parentheses will backtrack through multiple frames of subpattern matches.
var regexp58 = /a|b(?:[^b])*?c/;
shouldBe("regexp58.exec('badbc')", "['a']");
var regexp59 = /(X(?:.(?!X))*?Y)|(Y(?:.(?!Y))*?Z)/g;
shouldBe("'Y aaa X Match1 Y aaa Y Match2 Z'.match(regexp59)", "['X Match1 Y','Y Match2 Z']");

View File

@ -0,0 +1,275 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
A chunk of our port of PCRE's test suite, adapted to be more applicable to JavaScript.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS regex0.exec(input0); is results
PASS regex0.exec(input1); is results
PASS regex0.exec(input2); is results
PASS regex0.exec(input3); is results
PASS regex1.exec(input0); is results
PASS regex1.exec(input1); is results
PASS regex1.exec(input2); is results
PASS regex1.exec(input3); is results
PASS regex1.exec(input4); is results
PASS regex2.exec(input0); is results
PASS regex3.exec(input0); is results
PASS regex4.exec(input0); is results
PASS regex5.exec(input0); is results
PASS regex6.exec(input0); is results
PASS regex7.exec(input0); is results
PASS regex8.exec(input0); is results
PASS regex9.exec(input0); is results
PASS regex10.exec(input0); is results
PASS regex11.exec(input0); is results
PASS regex12.exec(input0); is results
PASS regex12.exec(input1); is results
PASS regex12.exec(input2); is results
PASS regex12.exec(input3); is results
PASS regex12.exec(input4); is results
PASS regex13.exec(input0); is results
PASS regex13.exec(input1); is results
PASS regex13.exec(input2); is results
PASS regex13.exec(input3); is results
PASS regex13.exec(input4); is results
PASS regex13.exec(input5); is results
PASS regex14.exec(input0); is results
PASS regex14.exec(input1); is results
PASS regex14.exec(input2); is results
PASS regex14.exec(input3); is results
PASS regex14.exec(input4); is results
PASS regex14.exec(input5); is results
PASS regex15.exec(input0); is results
PASS regex15.exec(input1); is results
PASS regex15.exec(input2); is results
PASS regex15.exec(input3); is results
PASS regex15.exec(input4); is results
PASS regex15.exec(input5); is results
PASS regex15.exec(input6); is results
PASS regex15.exec(input7); is results
PASS regex15.exec(input8); is results
PASS regex16.exec(input0); is results
PASS regex16.exec(input1); is results
PASS regex16.exec(input2); is results
PASS regex16.exec(input3); is results
PASS regex16.exec(input4); is results
PASS regex16.exec(input5); is results
PASS regex16.exec(input6); is results
PASS regex16.exec(input7); is results
PASS regex16.exec(input8); is results
PASS regex17.exec(input0); is results
PASS regex21.exec(input0); is results
PASS regex21.exec(input1); is results
PASS regex22.exec(input0); is results
PASS regex22.exec(input1); is results
PASS regex22.exec(input2); is results
PASS regex30.exec(input0); is results
PASS regex31.exec(input0); is results
PASS regex32.exec(input0); is results
PASS regex33.exec(input0); is results
PASS regex34.exec(input0); is results
PASS regex35.exec(input0); is results
PASS regex36.exec(input0); is results
PASS regex37.exec(input0); is results
PASS regex37.exec(input1); is results
PASS regex38.exec(input0); is results
PASS regex38.exec(input1); is results
PASS regex39.exec(input0); is results
PASS regex39.exec(input1); is results
PASS regex40.exec(input0); is results
PASS regex41.exec(input0); is results
PASS regex42.exec(input0); is results
PASS regex43.exec(input0); is results
PASS regex44.exec(input0); is results
PASS regex45.exec(input0); is results
PASS regex47.exec(input0); is results
PASS regex48.exec(input0); is results
PASS regex49.exec(input0); is results
PASS regex49.exec(input1); is results
PASS regex50.exec(input0); is results
PASS regex50.exec(input1); is results
PASS regex51.exec(input0); is results
PASS regex52.exec(input0); is results
PASS regex53.exec(input0); is results
PASS regex53.exec(input1); is results
PASS regex54.exec(input0); is results
PASS regex54.exec(input1); is results
PASS regex54.exec(input2); is results
PASS regex54.exec(input3); is results
PASS regex55.exec(input0); is results
PASS regex55.exec(input1); is results
PASS regex55.exec(input2); is results
PASS regex55.exec(input3); is results
PASS regex56.exec(input0); is results
PASS regex57.exec(input0); is results
PASS regex57.exec(input1); is results
PASS regex57.exec(input2); is results
PASS regex58.exec(input0); is results
PASS regex58.exec(input1); is results
PASS regex58.exec(input2); is results
PASS regex59.exec(input0); is results
PASS regex59.exec(input1); is results
PASS regex60.exec(input0); is results
PASS regex60.exec(input1); is results
PASS regex60.exec(input2); is results
PASS regex61.exec(input0); is results
PASS regex61.exec(input1); is results
PASS regex61.exec(input2); is results
PASS regex62.exec(input0); is results
PASS regex63.exec(input0); is results
PASS regex63.exec(input1); is results
PASS regex63.exec(input2); is results
PASS regex64.exec(input0); is results
PASS regex64.exec(input1); is results
PASS regex64.exec(input2); is results
PASS regex65.exec(input0); is results
PASS regex65.exec(input1); is results
PASS regex66.exec(input0); is results
PASS regex66.exec(input1); is results
PASS regex66.exec(input2); is results
PASS regex67.exec(input0); is results
PASS regex67.exec(input1); is results
PASS regex67.exec(input2); is results
PASS regex68.exec(input0); is results
PASS regex68.exec(input1); is results
PASS regex69.exec(input0); is results
PASS regex69.exec(input1); is results
PASS regex69.exec(input2); is results
PASS regex70.exec(input0); is results
PASS regex70.exec(input1); is results
PASS regex70.exec(input2); is results
PASS regex71.exec(input0); is results
PASS regex71.exec(input1); is results
PASS regex71.exec(input2); is results
PASS regex72.exec(input0); is results
PASS regex72.exec(input1); is results
PASS regex72.exec(input2); is results
PASS regex73.exec(input0); is results
PASS regex73.exec(input1); is results
PASS regex74.exec(input0); is results
PASS regex74.exec(input1); is results
PASS regex74.exec(input2); is results
PASS regex75.exec(input0); is results
PASS regex75.exec(input1); is results
PASS regex75.exec(input2); is results
PASS regex75.exec(input3); is results
PASS regex75.exec(input4); is results
PASS regex76.exec(input0); is results
PASS regex76.exec(input1); is results
PASS regex76.exec(input2); is results
PASS regex77.exec(input0); is results
PASS regex77.exec(input1); is results
PASS regex77.exec(input2); is results
PASS regex77.exec(input3); is results
PASS regex78.exec(input0); is results
PASS regex78.exec(input1); is results
PASS regex78.exec(input2); is results
PASS regex78.exec(input3); is results
PASS regex78.exec(input4); is results
PASS regex78.exec(input5); is results
PASS regex79.exec(input0); is results
PASS regex79.exec(input1); is results
PASS regex79.exec(input2); is results
PASS regex80.exec(input0); is results
PASS regex80.exec(input1); is results
PASS regex80.exec(input2); is results
PASS regex81.exec(input0); is results
PASS regex81.exec(input1); is results
PASS regex81.exec(input2); is results
PASS regex82.exec(input0); is results
PASS regex82.exec(input1); is results
PASS regex82.exec(input2); is results
PASS regex86.exec(input0); is results
PASS regex86.exec(input1); is results
PASS regex86.exec(input2); is results
PASS regex86.exec(input3); is results
PASS regex86.exec(input4); is results
PASS regex87.exec(input0); is results
PASS regex87.exec(input1); is results
PASS regex87.exec(input2); is results
PASS regex87.exec(input3); is results
PASS regex87.exec(input4); is results
PASS regex87.exec(input5); is results
PASS regex88.exec(input0); is results
PASS regex88.exec(input1); is results
PASS regex88.exec(input2); is results
PASS regex88.exec(input3); is results
PASS regex88.exec(input4); is results
PASS regex91.exec(input0); is results
PASS regex91.exec(input1); is results
PASS regex91.exec(input2); is results
PASS regex91.exec(input3); is results
PASS regex91.exec(input4); is results
PASS regex92.exec(input0); is results
PASS regex93.exec(input0); is results
PASS regex94.exec(input0); is results
PASS regex95.exec(input0); is results
PASS regex95.exec(input1); is results
PASS regex96.exec(input0); is results
PASS regex97.exec(input0); is results
PASS regex98.exec(input0); is results
PASS regex99.exec(input0); is results
PASS regex100.exec(input0); is results
PASS regex102.exec(input0); is results
PASS regex103.exec(input0); is results
PASS regex104.exec(input0); is results
PASS regex105.exec(input0); is results
PASS regex105.exec(input1); is results
PASS regex106.exec(input0); is results
PASS regex107.exec(input0); is results
PASS input0.match(regexGlobal0); is results
PASS input1.match(regexGlobal0); is results
PASS input0.match(regexGlobal1); is results
PASS input0.match(regexGlobal2); is results
PASS input0.match(regexGlobal3); is results
PASS input0.match(regexGlobal4); is results
PASS input0.match(regexGlobal5); is results
PASS input0.match(regexGlobal6); is results
PASS input0.match(regexGlobal7); is results
PASS input0.match(regexGlobal8); is results
PASS input0.match(regexGlobal9); is results
PASS input0.match(regexGlobal10); is results
PASS input0.match(regexGlobal11); is results
PASS input0.match(regexGlobal12); is results
PASS input0.match(regexGlobal13); is results
PASS input0.match(regexGlobal14); is results
PASS input0.match(regexGlobal15); is results
PASS input0.match(regexGlobal16); is results
PASS input0.match(regexGlobal17); is results
PASS input0.match(regexGlobal19); is results
PASS input0.match(regexGlobal21); is results
PASS input0.match(regexGlobal24); is results
PASS input0.match(regexGlobal25); is results
PASS input0.match(regexGlobal26); is results
PASS input0.match(regexGlobal27); is results
PASS input0.match(regexGlobal28); is results
PASS input1.match(regexGlobal28); is results
PASS input0.match(regexGlobal29); is results
PASS input1.match(regexGlobal29); is results
PASS successfullyParsed is true
TEST COMPLETE

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests assertions followed by quantifiers.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Testing regexp: /(?=a){0}/gm
PASS regexp.test('a') is true
PASS regexp.lastIndex is 0
Testing regexp: /(?=a){1}/gm
PASS regexp.test('a') is true
PASS regexp.lastIndex is 0
Testing regexp: /(?!a){0}/gm
PASS regexp.test('b') is true
PASS regexp.lastIndex is 0
Testing regexp: /(?!a){1}/gm
PASS regexp.test('b') is true
PASS regexp.lastIndex is 0
PASS /^(?=a)?b$/.test("b") is true
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,50 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"This page tests assertions followed by quantifiers."
);
var regexp;
regexp = /(?=a){0}/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('a')");
shouldBe("regexp.lastIndex", "0");
regexp = /(?=a){1}/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('a')");
shouldBe("regexp.lastIndex", "0");
regexp = /(?!a){0}/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('b')");
shouldBe("regexp.lastIndex", "0");
regexp = /(?!a){1}/gm;
debug("\nTesting regexp: " + regexp);
shouldBeTrue("regexp.test('b')");
shouldBe("regexp.lastIndex", "0");
shouldBeTrue('/^(?=a)?b$/.test("b")');

View File

@ -0,0 +1,53 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Some test cases identified by Waldemar Horwat in response to this bug: https://bugs.webkit.org/show_bug.cgi?id=48101
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS /(?:a*?){2,}/.exec("aa") is ["aa"]
PASS /(?:a*?){2,}/.exec("a") is ["a"]
PASS /(?:a*?){2,}/.exec("") is [""]
PASS /(?:a*?)/.exec("aa") is [""]
PASS /(?:a*?)/.exec("a") is [""]
PASS /(?:a*?)/.exec("") is [""]
PASS /(?:a*?)(?:a*?)(?:a*?)/.exec("aa") is [""]
PASS /(?:a*?)(?:a*?)(?:a*?)/.exec("a") is [""]
PASS /(?:a*?)(?:a*?)(?:a*?)/.exec("") is [""]
PASS /(?:a*?){2}/.exec("aa") is [""]
PASS /(?:a*?){2}/.exec("a") is [""]
PASS /(?:a*?){2}/.exec("") is [""]
PASS /(?:a*?){2,3}/.exec("aa") is ["a"]
PASS /(?:a*?){2,3}/.exec("a") is ["a"]
PASS /(?:a*?){2,3}/.exec("") is [""]
PASS /(?:a*?)?/.exec("aa") is ["a"]
PASS /(?:a*?)?/.exec("a") is ["a"]
PASS /(?:a*?)?/.exec("") is [""]
PASS /(?:a*?)*/.exec("aa") is ["aa"]
PASS /(?:a*?)*/.exec("a") is ["a"]
PASS /(?:a*?)*/.exec("") is [""]
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,54 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"Some test cases identified by Waldemar Horwat in response to this bug: https://bugs.webkit.org/show_bug.cgi?id=48101"
);
shouldBe('/(?:a*?){2,}/.exec("aa")', '["aa"]');
shouldBe('/(?:a*?){2,}/.exec("a")', '["a"]');
shouldBe('/(?:a*?){2,}/.exec("")', '[""]');
shouldBe('/(?:a*?)/.exec("aa")', '[""]');
shouldBe('/(?:a*?)/.exec("a")', '[""]');
shouldBe('/(?:a*?)/.exec("")', '[""]');
shouldBe('/(?:a*?)(?:a*?)(?:a*?)/.exec("aa")', '[""]');
shouldBe('/(?:a*?)(?:a*?)(?:a*?)/.exec("a")', '[""]');
shouldBe('/(?:a*?)(?:a*?)(?:a*?)/.exec("")', '[""]');
shouldBe('/(?:a*?){2}/.exec("aa")', '[""]');
shouldBe('/(?:a*?){2}/.exec("a")', '[""]');
shouldBe('/(?:a*?){2}/.exec("")', '[""]');
shouldBe('/(?:a*?){2,3}/.exec("aa")', '["a"]');
shouldBe('/(?:a*?){2,3}/.exec("a")', '["a"]');
shouldBe('/(?:a*?){2,3}/.exec("")', '[""]');
shouldBe('/(?:a*?)?/.exec("aa")', '["a"]');
shouldBe('/(?:a*?)?/.exec("a")', '["a"]');
shouldBe('/(?:a*?)?/.exec("")', '[""]');
shouldBe('/(?:a*?)*/.exec("aa")', '["aa"]');
shouldBe('/(?:a*?)*/.exec("a")', '["a"]');
shouldBe('/(?:a*?)*/.exec("")', '[""]');

View File

@ -0,0 +1,61 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This page tests toString conversion of RegExp objects, particularly wrt to '/' characters and RegExp.prototype.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS RegExp('/').source is "\\/"
PASS RegExp('').source is "(?:)"
PASS RegExp.prototype.source is "(?:)"
PASS RegExp('/').toString() is "/\\//"
PASS RegExp('').toString() is "/(?:)/"
PASS RegExp.prototype.toString() is "/(?:)/"
PASS testForwardSlash("^/$", "/"); is true
PASS testForwardSlash("^/$", "/"); is true
PASS testForwardSlash("^\/$", "/"); is true
PASS testForwardSlash("^\\/$", "\/"); is true
PASS testForwardSlash("^\\\/$", "\/"); is true
PASS testForwardSlash("^\\\\/$", "\\/"); is true
PASS testForwardSlash("^\\\\\/$", "\\/"); is true
PASS testForwardSlash("x/x/x", "x\/x\/x"); is true
PASS testForwardSlash("x\/x/x", "x\/x\/x"); is true
PASS testForwardSlash("x/x\/x", "x\/x\/x"); is true
PASS testForwardSlash("x\/x\/x", "x\/x\/x"); is true
PASS testLineTerminator("\n"); is false
PASS testLineTerminator("\\n"); is false
PASS testLineTerminator("\r"); is false
PASS testLineTerminator("\\r"); is false
PASS testLineTerminator("\u2028"); is false
PASS testLineTerminator("\\u2028"); is false
PASS testLineTerminator("\u2029"); is false
PASS testLineTerminator("\\u2029"); is false
PASS RegExp('[/]').source is '[/]'
PASS RegExp('\\[/]').source is '\\[\\/]'
PASS var o = new RegExp(); o.toString() === '/'+o.source+'/' && eval(o.toString()+'.exec(String())') is [""]
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,87 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("This page tests toString conversion of RegExp objects, particularly wrt to '/' characters and RegExp.prototype.");
function testForwardSlash(pattern, _string)
{
string = _string;
re1 = new RegExp(pattern);
re2 = eval(re1.toString());
return re1.test(string) && re2.test(string);
}
function testLineTerminator(pattern)
{
re1 = new RegExp(pattern);
return /\n|\r|\u2028|\u2029/.test(re1.toString());
}
shouldBe("RegExp('/').source", '"\\\\/"');
shouldBe("RegExp('').source", '"(?:)"');
shouldBe("RegExp.prototype.source", '"(?:)"');
shouldBe("RegExp('/').toString()", '"/\\\\//"');
shouldBe("RegExp('').toString()", '"/(?:)/"');
shouldBe("RegExp.prototype.toString()", '"/(?:)/"');
// These strings are equivalent, since the '\' is identity escaping the '/' at the string level.
shouldBeTrue('testForwardSlash("^/$", "/");');
shouldBeTrue('testForwardSlash("^\/$", "/");');
// This string passes "^\/$" to the RegExp, so the '/' is escaped in the re!
shouldBeTrue('testForwardSlash("^\\/$", "/");');
// These strings pass "^\\/$" and "^\\\/$" respectively to the RegExp, giving one '\' to match.
shouldBeTrue('testForwardSlash("^\\\\/$", "\\/");');
shouldBeTrue('testForwardSlash("^\\\\\\/$", "\\/");');
// These strings match two backslashes (the second with the '/' escaped).
shouldBeTrue('testForwardSlash("^\\\\\\\\/$", "\\\\/");');
shouldBeTrue('testForwardSlash("^\\\\\\\\\\/$", "\\\\/");');
// Test that nothing goes wrongif there are multiple forward slashes!
shouldBeTrue('testForwardSlash("x/x/x", "x\\/x\\/x");');
shouldBeTrue('testForwardSlash("x\\/x/x", "x\\/x\\/x");');
shouldBeTrue('testForwardSlash("x/x\\/x", "x\\/x\\/x");');
shouldBeTrue('testForwardSlash("x\\/x\\/x", "x\\/x\\/x");');
shouldBeFalse('testLineTerminator("\\n");');
shouldBeFalse('testLineTerminator("\\\\n");');
shouldBeFalse('testLineTerminator("\\r");');
shouldBeFalse('testLineTerminator("\\\\r");');
shouldBeFalse('testLineTerminator("\\u2028");');
shouldBeFalse('testLineTerminator("\\\\u2028");');
shouldBeFalse('testLineTerminator("\\u2029");');
shouldBeFalse('testLineTerminator("\\\\u2029");');
shouldBe("RegExp('[/]').source", "'[/]'");
shouldBe("RegExp('\\\\[/]').source", "'\\\\[\\\\/]'");
// See 15.10.6.4
// The first half of this checks that:
// Return the String value formed by concatenating the Strings "/", the
// String value of the source property of this RegExp object, and "/";
// The second half checks that:
// The returned String has the form of a RegularExpressionLiteral that
// evaluates to another RegExp object with the same behaviour as this object.
shouldBe("var o = new RegExp(); o.toString() === '/'+o.source+'/' && eval(o.toString()+'.exec(String())')", '[""]');

View File

@ -0,0 +1,349 @@
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
https://bugs.webkit.org/show_bug.cgi?id=82063
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS /ΣΤΙΓΜΑΣ/i.test("στιγμας") is true
PASS /ΔΣΔ/i.test("δςδ") is true
PASS /ς/i.test("σ") is true
PASS /σ/i.test("ς") is true
PASS /἖/i.test("἖") is true
PASS /DŽ/i.test("DŽ") is true
PASS /[ǃ-Dž]/i.test("DŽ") is true
PASS /DŽ/i.test("Dž") is true
PASS /[ǃ-Dž]/i.test("Dž") is true
PASS /DŽ/i.test("dž") is true
PASS /[ǃ-Dž]/i.test("dž") is true
PASS /Dž/i.test("DŽ") is true
PASS /[DŽ-dž]/i.test("DŽ") is true
PASS /Dž/i.test("Dž") is true
PASS /[DŽ-dž]/i.test("Dž") is true
PASS /Dž/i.test("dž") is true
PASS /[DŽ-dž]/i.test("dž") is true
PASS /dž/i.test("DŽ") is true
PASS /[Dž-LJ]/i.test("DŽ") is true
PASS /dž/i.test("Dž") is true
PASS /[Dž-LJ]/i.test("Dž") is true
PASS /dž/i.test("dž") is true
PASS /[Dž-LJ]/i.test("dž") is true
PASS /LJ/i.test("LJ") is true
PASS /[dž-Lj]/i.test("LJ") is true
PASS /LJ/i.test("Lj") is true
PASS /[dž-Lj]/i.test("Lj") is true
PASS /LJ/i.test("lj") is true
PASS /[dž-Lj]/i.test("lj") is true
PASS /Lj/i.test("LJ") is true
PASS /[LJ-lj]/i.test("LJ") is true
PASS /Lj/i.test("Lj") is true
PASS /[LJ-lj]/i.test("Lj") is true
PASS /Lj/i.test("lj") is true
PASS /[LJ-lj]/i.test("lj") is true
PASS /lj/i.test("LJ") is true
PASS /[Lj-NJ]/i.test("LJ") is true
PASS /lj/i.test("Lj") is true
PASS /[Lj-NJ]/i.test("Lj") is true
PASS /lj/i.test("lj") is true
PASS /[Lj-NJ]/i.test("lj") is true
PASS /NJ/i.test("NJ") is true
PASS /[lj-Nj]/i.test("NJ") is true
PASS /NJ/i.test("Nj") is true
PASS /[lj-Nj]/i.test("Nj") is true
PASS /NJ/i.test("nj") is true
PASS /[lj-Nj]/i.test("nj") is true
PASS /Nj/i.test("NJ") is true
PASS /[NJ-nj]/i.test("NJ") is true
PASS /Nj/i.test("Nj") is true
PASS /[NJ-nj]/i.test("Nj") is true
PASS /Nj/i.test("nj") is true
PASS /[NJ-nj]/i.test("nj") is true
PASS /nj/i.test("NJ") is true
PASS /[Nj-Ǎ]/i.test("NJ") is true
PASS /nj/i.test("Nj") is true
PASS /[Nj-Ǎ]/i.test("Nj") is true
PASS /nj/i.test("nj") is true
PASS /[Nj-Ǎ]/i.test("nj") is true
PASS /DZ/i.test("DZ") is true
PASS /[ǰ-Dz]/i.test("DZ") is true
PASS /DZ/i.test("Dz") is true
PASS /[ǰ-Dz]/i.test("Dz") is true
PASS /DZ/i.test("dz") is true
PASS /[ǰ-Dz]/i.test("dz") is true
PASS /Dz/i.test("DZ") is true
PASS /[DZ-dz]/i.test("DZ") is true
PASS /Dz/i.test("Dz") is true
PASS /[DZ-dz]/i.test("Dz") is true
PASS /Dz/i.test("dz") is true
PASS /[DZ-dz]/i.test("dz") is true
PASS /dz/i.test("DZ") is true
PASS /[Dz-Ǵ]/i.test("DZ") is true
PASS /dz/i.test("Dz") is true
PASS /[Dz-Ǵ]/i.test("Dz") is true
PASS /dz/i.test("dz") is true
PASS /[Dz-Ǵ]/i.test("dz") is true
PASS /Β/i.test("Β") is true
PASS /[Α-Γ]/i.test("Β") is true
PASS /Β/i.test("β") is true
PASS /[Α-Γ]/i.test("β") is true
PASS /Β/i.test("ϐ") is true
PASS /[Α-Γ]/i.test("ϐ") is true
PASS /β/i.test("Β") is true
PASS /[α-γ]/i.test("Β") is true
PASS /β/i.test("β") is true
PASS /[α-γ]/i.test("β") is true
PASS /β/i.test("ϐ") is true
PASS /[α-γ]/i.test("ϐ") is true
PASS /ϐ/i.test("Β") is true
PASS /[Ϗ-ϑ]/i.test("Β") is true
PASS /ϐ/i.test("β") is true
PASS /[Ϗ-ϑ]/i.test("β") is true
PASS /ϐ/i.test("ϐ") is true
PASS /[Ϗ-ϑ]/i.test("ϐ") is true
PASS /Ε/i.test("Ε") is true
PASS /[Δ-Ζ]/i.test("Ε") is true
PASS /Ε/i.test("ε") is true
PASS /[Δ-Ζ]/i.test("ε") is true
PASS /Ε/i.test("ϵ") is true
PASS /[Δ-Ζ]/i.test("ϵ") is true
PASS /ε/i.test("Ε") is true
PASS /[δ-ζ]/i.test("Ε") is true
PASS /ε/i.test("ε") is true
PASS /[δ-ζ]/i.test("ε") is true
PASS /ε/i.test("ϵ") is true
PASS /[δ-ζ]/i.test("ϵ") is true
PASS /ϵ/i.test("Ε") is true
PASS /[ϴ-϶]/i.test("Ε") is true
PASS /ϵ/i.test("ε") is true
PASS /[ϴ-϶]/i.test("ε") is true
PASS /ϵ/i.test("ϵ") is true
PASS /[ϴ-϶]/i.test("ϵ") is true
PASS /Θ/i.test("Θ") is true
PASS /[Η-Ι]/i.test("Θ") is true
PASS /Θ/i.test("θ") is true
PASS /[Η-Ι]/i.test("θ") is true
PASS /Θ/i.test("ϑ") is true
PASS /[Η-Ι]/i.test("ϑ") is true
PASS /θ/i.test("Θ") is true
PASS /[η-ι]/i.test("Θ") is true
PASS /θ/i.test("θ") is true
PASS /[η-ι]/i.test("θ") is true
PASS /θ/i.test("ϑ") is true
PASS /[η-ι]/i.test("ϑ") is true
PASS /ϑ/i.test("Θ") is true
PASS /[ϐ-ϒ]/i.test("Θ") is true
PASS /ϑ/i.test("θ") is true
PASS /[ϐ-ϒ]/i.test("θ") is true
PASS /ϑ/i.test("ϑ") is true
PASS /[ϐ-ϒ]/i.test("ϑ") is true
PASS /ͅ/i.test("ͅ") is true
PASS /[̈́-͆]/i.test("ͅ") is true
PASS /ͅ/i.test("Ι") is true
PASS /[̈́-͆]/i.test("Ι") is true
PASS /ͅ/i.test("ι") is true
PASS /[̈́-͆]/i.test("ι") is true
PASS /ͅ/i.test("ι") is true
PASS /[̈́-͆]/i.test("ι") is true
PASS /Ι/i.test("ͅ") is true
PASS /[Θ-Κ]/i.test("ͅ") is true
PASS /Ι/i.test("Ι") is true
PASS /[Θ-Κ]/i.test("Ι") is true
PASS /Ι/i.test("ι") is true
PASS /[Θ-Κ]/i.test("ι") is true
PASS /Ι/i.test("ι") is true
PASS /[Θ-Κ]/i.test("ι") is true
PASS /ι/i.test("ͅ") is true
PASS /[θ-κ]/i.test("ͅ") is true
PASS /ι/i.test("Ι") is true
PASS /[θ-κ]/i.test("Ι") is true
PASS /ι/i.test("ι") is true
PASS /[θ-κ]/i.test("ι") is true
PASS /ι/i.test("ι") is true
PASS /[θ-κ]/i.test("ι") is true
PASS /ι/i.test("ͅ") is true
PASS /[᾽-᾿]/i.test("ͅ") is true
PASS /ι/i.test("Ι") is true
PASS /[᾽-᾿]/i.test("Ι") is true
PASS /ι/i.test("ι") is true
PASS /[᾽-᾿]/i.test("ι") is true
PASS /ι/i.test("ι") is true
PASS /[᾽-᾿]/i.test("ι") is true
PASS /Κ/i.test("Κ") is true
PASS /[Ι-Λ]/i.test("Κ") is true
PASS /Κ/i.test("κ") is true
PASS /[Ι-Λ]/i.test("κ") is true
PASS /Κ/i.test("ϰ") is true
PASS /[Ι-Λ]/i.test("ϰ") is true
PASS /κ/i.test("Κ") is true
PASS /[ι-λ]/i.test("Κ") is true
PASS /κ/i.test("κ") is true
PASS /[ι-λ]/i.test("κ") is true
PASS /κ/i.test("ϰ") is true
PASS /[ι-λ]/i.test("ϰ") is true
PASS /ϰ/i.test("Κ") is true
PASS /[ϯ-ϱ]/i.test("Κ") is true
PASS /ϰ/i.test("κ") is true
PASS /[ϯ-ϱ]/i.test("κ") is true
PASS /ϰ/i.test("ϰ") is true
PASS /[ϯ-ϱ]/i.test("ϰ") is true
PASS /µ/i.test("µ") is true
PASS /[´-¶]/i.test("µ") is true
PASS /µ/i.test("Μ") is true
PASS /[´-¶]/i.test("Μ") is true
PASS /µ/i.test("μ") is true
PASS /[´-¶]/i.test("μ") is true
PASS /Μ/i.test("µ") is true
PASS /[Λ-Ν]/i.test("µ") is true
PASS /Μ/i.test("Μ") is true
PASS /[Λ-Ν]/i.test("Μ") is true
PASS /Μ/i.test("μ") is true
PASS /[Λ-Ν]/i.test("μ") is true
PASS /μ/i.test("µ") is true
PASS /[λ-ν]/i.test("µ") is true
PASS /μ/i.test("Μ") is true
PASS /[λ-ν]/i.test("Μ") is true
PASS /μ/i.test("μ") is true
PASS /[λ-ν]/i.test("μ") is true
PASS /Π/i.test("Π") is true
PASS /[Ο-Ρ]/i.test("Π") is true
PASS /Π/i.test("π") is true
PASS /[Ο-Ρ]/i.test("π") is true
PASS /Π/i.test("ϖ") is true
PASS /[Ο-Ρ]/i.test("ϖ") is true
PASS /π/i.test("Π") is true
PASS /[ο-ρ]/i.test("Π") is true
PASS /π/i.test("π") is true
PASS /[ο-ρ]/i.test("π") is true
PASS /π/i.test("ϖ") is true
PASS /[ο-ρ]/i.test("ϖ") is true
PASS /ϖ/i.test("Π") is true
PASS /[ϕ-ϗ]/i.test("Π") is true
PASS /ϖ/i.test("π") is true
PASS /[ϕ-ϗ]/i.test("π") is true
PASS /ϖ/i.test("ϖ") is true
PASS /[ϕ-ϗ]/i.test("ϖ") is true
PASS /Ρ/i.test("Ρ") is true
PASS /[Π-΢]/i.test("Ρ") is true
PASS /Ρ/i.test("ρ") is true
PASS /[Π-΢]/i.test("ρ") is true
PASS /Ρ/i.test("ϱ") is true
PASS /[Π-΢]/i.test("ϱ") is true
PASS /ρ/i.test("Ρ") is true
PASS /[π-ς]/i.test("Ρ") is true
PASS /ρ/i.test("ρ") is true
PASS /[π-ς]/i.test("ρ") is true
PASS /ρ/i.test("ϱ") is true
PASS /[π-ς]/i.test("ϱ") is true
PASS /ϱ/i.test("Ρ") is true
PASS /[ϰ-ϲ]/i.test("Ρ") is true
PASS /ϱ/i.test("ρ") is true
PASS /[ϰ-ϲ]/i.test("ρ") is true
PASS /ϱ/i.test("ϱ") is true
PASS /[ϰ-ϲ]/i.test("ϱ") is true
PASS /Σ/i.test("Σ") is true
PASS /[΢-Τ]/i.test("Σ") is true
PASS /Σ/i.test("ς") is true
PASS /[΢-Τ]/i.test("ς") is true
PASS /Σ/i.test("σ") is true
PASS /[΢-Τ]/i.test("σ") is true
PASS /ς/i.test("Σ") is true
PASS /[ρ-σ]/i.test("Σ") is true
PASS /ς/i.test("ς") is true
PASS /[ρ-σ]/i.test("ς") is true
PASS /ς/i.test("σ") is true
PASS /[ρ-σ]/i.test("σ") is true
PASS /σ/i.test("Σ") is true
PASS /[ς-τ]/i.test("Σ") is true
PASS /σ/i.test("ς") is true
PASS /[ς-τ]/i.test("ς") is true
PASS /σ/i.test("σ") is true
PASS /[ς-τ]/i.test("σ") is true
PASS /Φ/i.test("Φ") is true
PASS /[Υ-Χ]/i.test("Φ") is true
PASS /Φ/i.test("φ") is true
PASS /[Υ-Χ]/i.test("φ") is true
PASS /Φ/i.test("ϕ") is true
PASS /[Υ-Χ]/i.test("ϕ") is true
PASS /φ/i.test("Φ") is true
PASS /[υ-χ]/i.test("Φ") is true
PASS /φ/i.test("φ") is true
PASS /[υ-χ]/i.test("φ") is true
PASS /φ/i.test("ϕ") is true
PASS /[υ-χ]/i.test("ϕ") is true
PASS /ϕ/i.test("Φ") is true
PASS /[ϔ-ϖ]/i.test("Φ") is true
PASS /ϕ/i.test("φ") is true
PASS /[ϔ-ϖ]/i.test("φ") is true
PASS /ϕ/i.test("ϕ") is true
PASS /[ϔ-ϖ]/i.test("ϕ") is true
PASS /Ṡ/i.test("Ṡ") is true
PASS /[ṟ-ṡ]/i.test("Ṡ") is true
PASS /Ṡ/i.test("ṡ") is true
PASS /[ṟ-ṡ]/i.test("ṡ") is true
PASS /Ṡ/i.test("ẛ") is true
PASS /[ṟ-ṡ]/i.test("ẛ") is true
PASS /ṡ/i.test("Ṡ") is true
PASS /[Ṡ-Ṣ]/i.test("Ṡ") is true
PASS /ṡ/i.test("ṡ") is true
PASS /[Ṡ-Ṣ]/i.test("ṡ") is true
PASS /ṡ/i.test("ẛ") is true
PASS /[Ṡ-Ṣ]/i.test("ẛ") is true
PASS /ẛ/i.test("Ṡ") is true
PASS /[ẚ-ẜ]/i.test("Ṡ") is true
PASS /ẛ/i.test("ṡ") is true
PASS /[ẚ-ẜ]/i.test("ṡ") is true
PASS /ẛ/i.test("ẛ") is true
PASS /[ẚ-ẜ]/i.test("ẛ") is true
PASS /Ϗ/i.test("Ϗ") is true
PASS /ϗ/i.test("Ϗ") is true
PASS /Ϗ/i.test("ϗ") is true
PASS /ϗ/i.test("ϗ") is true
PASS /ἑ/i.test("ἑ") is true
PASS /Ἑ/i.test("ἑ") is true
PASS /ἑ/i.test("Ἑ") is true
PASS /Ἑ/i.test("Ἑ") is true
PASS /҉/i.test("Ҋ") is false
PASS /Ҋ/i.test("Ҋ") is true
PASS /ҋ/i.test("Ҋ") is true
PASS /Ҍ/i.test("Ҋ") is false
PASS /҉/i.test("ҋ") is false
PASS /Ҋ/i.test("ҋ") is true
PASS /ҋ/i.test("ҋ") is true
PASS /Ҍ/i.test("ҋ") is false
PASS /[҉-Ҋ]/i.test("ҋ") is true
PASS /[ҋ-Ҍ]/i.test("Ҋ") is true
PASS /ӄ/i.test("Ӆ") is false
PASS /Ӆ/i.test("Ӆ") is true
PASS /ӆ/i.test("Ӆ") is true
PASS /Ӈ/i.test("Ӆ") is false
PASS /ӄ/i.test("ӆ") is false
PASS /Ӆ/i.test("ӆ") is true
PASS /ӆ/i.test("ӆ") is true
PASS /Ӈ/i.test("ӆ") is false
PASS /[ӄ-Ӆ]/i.test("ӆ") is true
PASS /[ӆ-Ӈ]/i.test("Ӆ") is true
PASS successfullyParsed is true
TEST COMPLETE

View File

@ -0,0 +1,101 @@
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("https://bugs.webkit.org/show_bug.cgi?id=82063");
shouldBeTrue('/ΣΤΙΓΜΑΣ/i.test("στιγμας")');
shouldBeTrue('/ΔΣΔ/i.test("δςδ")');
shouldBeTrue('/ς/i.test("σ")');
shouldBeTrue('/σ/i.test("ς")');
// Simple case, has no canonical equivalents
shouldBeTrue('/\u1f16/i.test("\u1f16")')
// Test the sets of USC2 code points that have more than one canonically equivalent value.
function ucs2CodePoint(x)
{
var s = x.toString(16);
while (s.length < 4)
s = 0 + s;
return eval('"\\u' + s + '"');
}
function testSet(set)
{
for (i in set) {
for (j in set) {
shouldBeTrue('/' + ucs2CodePoint(set[i]) + '/i.test("' + ucs2CodePoint(set[j]) + '")')
shouldBeTrue('/[' + ucs2CodePoint(set[i] - 1) + '-' + ucs2CodePoint(set[i] + 1) + ']/i.test("' + ucs2CodePoint(set[j]) + '")')
}
}
}
testSet([ 0x01c4, 0x01c5, 0x01c6 ]);
testSet([ 0x01c7, 0x01c8, 0x01c9 ]);
testSet([ 0x01ca, 0x01cb, 0x01cc ]);
testSet([ 0x01f1, 0x01f2, 0x01f3 ]);
testSet([ 0x0392, 0x03b2, 0x03d0 ]);
testSet([ 0x0395, 0x03b5, 0x03f5 ]);
testSet([ 0x0398, 0x03b8, 0x03d1 ]);
testSet([ 0x0345, 0x0399, 0x03b9, 0x1fbe ]);
testSet([ 0x039a, 0x03ba, 0x03f0 ]);
testSet([ 0x00b5, 0x039c, 0x03bc ]);
testSet([ 0x03a0, 0x03c0, 0x03d6 ]);
testSet([ 0x03a1, 0x03c1, 0x03f1 ]);
testSet([ 0x03a3, 0x03c2, 0x03c3 ]);
testSet([ 0x03a6, 0x03c6, 0x03d5 ]);
testSet([ 0x1e60, 0x1e61, 0x1e9b ]);
// Test a couple of lo/hi pairs
shouldBeTrue('/\u03cf/i.test("\u03cf")')
shouldBeTrue('/\u03d7/i.test("\u03cf")')
shouldBeTrue('/\u03cf/i.test("\u03d7")')
shouldBeTrue('/\u03d7/i.test("\u03d7")')
shouldBeTrue('/\u1f11/i.test("\u1f11")')
shouldBeTrue('/\u1f19/i.test("\u1f11")')
shouldBeTrue('/\u1f11/i.test("\u1f19")')
shouldBeTrue('/\u1f19/i.test("\u1f19")')
// Test an aligned alternating capitalization pair.
shouldBeFalse('/\u0489/i.test("\u048a")')
shouldBeTrue('/\u048a/i.test("\u048a")')
shouldBeTrue('/\u048b/i.test("\u048a")')
shouldBeFalse('/\u048c/i.test("\u048a")')
shouldBeFalse('/\u0489/i.test("\u048b")')
shouldBeTrue('/\u048a/i.test("\u048b")')
shouldBeTrue('/\u048b/i.test("\u048b")')
shouldBeFalse('/\u048c/i.test("\u048b")')
shouldBeTrue('/[\u0489-\u048a]/i.test("\u048b")')
shouldBeTrue('/[\u048b-\u048c]/i.test("\u048a")')
// Test an unaligned alternating capitalization pair.
shouldBeFalse('/\u04c4/i.test("\u04c5")')
shouldBeTrue('/\u04c5/i.test("\u04c5")')
shouldBeTrue('/\u04c6/i.test("\u04c5")')
shouldBeFalse('/\u04c7/i.test("\u04c5")')
shouldBeFalse('/\u04c4/i.test("\u04c6")')
shouldBeTrue('/\u04c5/i.test("\u04c6")')
shouldBeTrue('/\u04c6/i.test("\u04c6")')
shouldBeFalse('/\u04c7/i.test("\u04c6")')
shouldBeTrue('/[\u04c4-\u04c5]/i.test("\u04c6")')
shouldBeTrue('/[\u04c6-\u04c7]/i.test("\u04c5")')
var successfullyParsed = true;