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

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: 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 assertFalse(r2.test("first\\u")); // This used to return true (which was a bug ).
arv (Not doing code reviews) 2014/12/15 15:53:45 long line here and below
marja 2014/12/16 11:45:52 Done; I wonder why presubmit didn't whine!
22
23 r2 = RegExp("first\\u");
24 assertTrue(r2.test("firstu"));
25 assertFalse(r2.test("first\\u")); // This used to return true (which was a bug ).
26
27 var r3 = /first\usecond/;
28 assertTrue(r3.test("firstusecond"));
29 assertFalse(r3.test("first\\usecond"));
30
31 r3 = RegExp("first\\usecond");
32 assertTrue(r3.test("firstusecond"));
33 assertFalse(r3.test("first\\usecond"));
34
35 var r4 = /first\u123second/;
36 assertTrue(r4.test("firstu123second"));
37 assertFalse(r4.test("first\\u123second"));
38
39 r4 = RegExp("first\\u123second");
40 assertTrue(r4.test("firstu123second"));
41 assertFalse(r4.test("first\\u123second"));
42
43 // \X where X is not a legal escape character is treated as identity escape
44 // too.
45 var r5 = /\a/;
46 assertTrue(r5.test("a"));
47
48 r5 = RegExp("\\a");
49 assertTrue(r5.test("a"));
50
51 var r6 = /\asecond/;
52 assertTrue(r6.test("asecond"));
53
54 r6 = RegExp("\\asecond");
55 assertTrue(r6.test("asecond"));
56
57 var r7 = /first\a/;
58 assertTrue(r7.test("firsta"));
59 assertFalse(r7.test("first\\a"));
60
61 r7 = RegExp("first\\a");
62 assertTrue(r7.test("firsta"));
63 assertFalse(r7.test("first\\a"));
64
65 var r8 = /first\asecond/;
66 assertTrue(r8.test("firstasecond"));
67 assertFalse(r8.test("first\\asecond"));
68
69 r8 = RegExp("first\\asecond");
70 assertTrue(r8.test("firstasecond"));
71 assertFalse(r8.test("first\\asecond"));
72 })();
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