| Index: test/webkit/fast/regex/invalid-range-in-class.js
|
| diff --git a/test/webkit/vardecl-blocks-init.js b/test/webkit/fast/regex/invalid-range-in-class.js
|
| similarity index 58%
|
| copy from test/webkit/vardecl-blocks-init.js
|
| copy to test/webkit/fast/regex/invalid-range-in-class.js
|
| index b77f191b7fe3ce23199e99b3d9f6fe0da4c28de6..35bf32db98ef12a2894f355cbb3326c5e6eaadc5 100644
|
| --- a/test/webkit/vardecl-blocks-init.js
|
| +++ b/test/webkit/fast/regex/invalid-range-in-class.js
|
| @@ -22,56 +22,29 @@
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| description(
|
| -"This test checks that variable declarations with initializers inside of catch and with blocks do not set values in a deeper scope."
|
| +"This page tests invalid character ranges in character classes."
|
| );
|
|
|
| -function catchTest() {
|
| - var e = "foo";
|
| +// These test a basic range / non range.
|
| +shouldBe('/[a-c]+/.exec("-acbd");', '["acb"]');
|
| +shouldBe('/[a\\-c]+/.exec("-acbd")', '["-ac"]');
|
|
|
| - try {
|
| - throw "bar";
|
| - } catch (e) {
|
| - var e = "baz";
|
| - }
|
| +// A reverse-range is invalid.
|
| +shouldThrow('/[c-a]+/.exec("-acbd");');
|
|
|
| - return e;
|
| -}
|
| +// 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"]');
|
|
|
| -function catchTest2() {
|
| - var e = "foo";
|
| +// 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"]');
|
|
|
| - try {
|
| - throw "bar";
|
| - } catch (e) {
|
| - var e = "baz";
|
| +// 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"]');
|
|
|
| - return e;
|
| - }
|
| -}
|
| -
|
| -function withTest() {
|
| - var e = "foo"
|
| - var object = { 'e' : "bar" };
|
| -
|
| - with (object) {
|
| - var e = "baz";
|
| - }
|
| -
|
| - return e;
|
| -}
|
| -
|
| -function withTest2() {
|
| - var e = "foo"
|
| - var object = { 'e' : "bar" };
|
| -
|
| - with (object) {
|
| - var e = "baz";
|
| -
|
| - return e;
|
| - }
|
| -}
|
| -
|
| -shouldBe("catchTest()", "'foo'");
|
| -shouldBe("catchTest2()", "'baz'");
|
| -shouldBe("withTest()", "'foo'");
|
| -shouldBe("withTest2()", "'baz'");
|
| +// A hyphen after a character-class is not invalid.
|
| +shouldBe('/[\\d-]+/.exec("1-3xy")', '["1-3"]');
|
|
|