Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: test/mjsunit/regress/regress-3756.js

Issue 802313003: RegExpParser: Fix Reset()ting to the end. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: long lines Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 (function TestIdentityEscapes() {
6 // \u not followed by 4 hex digits is treated as an identity escape.
7 var r0 = /\u/;
8 assertTrue(r0.test("u"));
9
10 r0 = RegExp("\\u");
11 assertTrue(r0.test("u"));
12
13 var r1 = /\usecond/;
14 assertTrue(r1.test("usecond"));
15
16 r1 = RegExp("\\usecond");
17 assertTrue(r1.test("usecond"));
18
19 var r2 = /first\u/;
20 assertTrue(r2.test("firstu"));
21 // This used to return true (which was a bug).
22 assertFalse(r2.test("first\\u"));
23
24 r2 = RegExp("first\\u");
25 assertTrue(r2.test("firstu"));
26 // This used to return true (which was a bug).
27 assertFalse(r2.test("first\\u"));
28
29 var r3 = /first\usecond/;
30 assertTrue(r3.test("firstusecond"));
31 assertFalse(r3.test("first\\usecond"));
32
33 r3 = RegExp("first\\usecond");
34 assertTrue(r3.test("firstusecond"));
35 assertFalse(r3.test("first\\usecond"));
36
37 var r4 = /first\u123second/;
38 assertTrue(r4.test("firstu123second"));
39 assertFalse(r4.test("first\\u123second"));
40
41 r4 = RegExp("first\\u123second");
42 assertTrue(r4.test("firstu123second"));
43 assertFalse(r4.test("first\\u123second"));
44
45 // \X where X is not a legal escape character is treated as identity escape
46 // too.
47 var r5 = /\a/;
48 assertTrue(r5.test("a"));
49
50 r5 = RegExp("\\a");
51 assertTrue(r5.test("a"));
52
53 var r6 = /\asecond/;
54 assertTrue(r6.test("asecond"));
55
56 r6 = RegExp("\\asecond");
57 assertTrue(r6.test("asecond"));
58
59 var r7 = /first\a/;
60 assertTrue(r7.test("firsta"));
61 assertFalse(r7.test("first\\a"));
62
63 r7 = RegExp("first\\a");
64 assertTrue(r7.test("firsta"));
65 assertFalse(r7.test("first\\a"));
66
67 var r8 = /first\asecond/;
68 assertTrue(r8.test("firstasecond"));
69 assertFalse(r8.test("first\\asecond"));
70
71 r8 = RegExp("first\\asecond");
72 assertTrue(r8.test("firstasecond"));
73 assertFalse(r8.test("first\\asecond"));
74 })();
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698