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

Side by Side Diff: test/cctest/test-regexp.cc

Issue 1571563003: [regexp] quantifier refers to the surrogate pair in unicode regexp. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@unicoderegexpatom
Patch Set: rebase Created 4 years, 11 months 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/regexp/regexp-parser.cc ('k') | test/mjsunit/harmony/unicode-escapes-in-regexps.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 CheckParseEq("\\x34", "'\x34'"); 302 CheckParseEq("\\x34", "'\x34'");
303 CheckParseEq("\\x60", "'\x60'"); 303 CheckParseEq("\\x60", "'\x60'");
304 CheckParseEq("\\x3z", "'x3z'"); 304 CheckParseEq("\\x3z", "'x3z'");
305 CheckParseEq("\\c", "'\\c'"); 305 CheckParseEq("\\c", "'\\c'");
306 CheckParseEq("\\u0034", "'\x34'"); 306 CheckParseEq("\\u0034", "'\x34'");
307 CheckParseEq("\\u003z", "'u003z'"); 307 CheckParseEq("\\u003z", "'u003z'");
308 CheckParseEq("foo[z]*", "(: 'foo' (# 0 - g [z]))"); 308 CheckParseEq("foo[z]*", "(: 'foo' (# 0 - g [z]))");
309 309
310 // Unicode regexps 310 // Unicode regexps
311 CheckParseEq("\\u{12345}", "'\\ud808\\udf45'", true); 311 CheckParseEq("\\u{12345}", "'\\ud808\\udf45'", true);
312 CheckParseEq("\\u{12345}\\u{23456}", "'\\ud808\\udf45\\ud84d\\udc56'", true); 312 CheckParseEq("\\u{12345}\\u{23456}", "(! '\\ud808\\udf45' '\\ud84d\\udc56')",
313 true);
313 CheckParseEq("\\u{12345}|\\u{23456}", "(| '\\ud808\\udf45' '\\ud84d\\udc56')", 314 CheckParseEq("\\u{12345}|\\u{23456}", "(| '\\ud808\\udf45' '\\ud84d\\udc56')",
314 true); 315 true);
316 CheckParseEq("\\u{12345}{3}", "(# 3 3 g '\\ud808\\udf45')", true);
317 CheckParseEq("\\u{12345}*", "(# 0 - g '\\ud808\\udf45')", true);
315 318
316 CHECK_SIMPLE("", false); 319 CHECK_SIMPLE("", false);
317 CHECK_SIMPLE("a", true); 320 CHECK_SIMPLE("a", true);
318 CHECK_SIMPLE("a|b", false); 321 CHECK_SIMPLE("a|b", false);
319 CHECK_SIMPLE("a\\n", false); 322 CHECK_SIMPLE("a\\n", false);
320 CHECK_SIMPLE("^a", false); 323 CHECK_SIMPLE("^a", false);
321 CHECK_SIMPLE("a$", false); 324 CHECK_SIMPLE("a$", false);
322 CHECK_SIMPLE("a\\b!", false); 325 CHECK_SIMPLE("a\\b!", false);
323 CHECK_SIMPLE("a\\Bb", false); 326 CHECK_SIMPLE("a\\Bb", false);
324 CHECK_SIMPLE("a*", false); 327 CHECK_SIMPLE("a*", false);
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 // .toString() throws on non-RegExps that aren't RegExp.prototype 1931 // .toString() throws on non-RegExps that aren't RegExp.prototype
1929 v8::Local<v8::Value> resultToStringError = CompileRun( 1932 v8::Local<v8::Value> resultToStringError = CompileRun(
1930 "var exception;" 1933 "var exception;"
1931 "try { RegExp.prototype.toString.call(null) }" 1934 "try { RegExp.prototype.toString.call(null) }"
1932 "catch (e) { exception = e; }" 1935 "catch (e) { exception = e; }"
1933 "exception"); 1936 "exception");
1934 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]); 1937 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]);
1935 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]); 1938 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]);
1936 CHECK(resultToStringError->IsObject()); 1939 CHECK(resultToStringError->IsObject());
1937 } 1940 }
OLDNEW
« no previous file with comments | « src/regexp/regexp-parser.cc ('k') | test/mjsunit/harmony/unicode-escapes-in-regexps.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698