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

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

Issue 2768443003: [regexp] Fold repeated assertions (Closed)
Patch Set: Simpler solution during parsing Created 3 years, 9 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') | 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
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 CheckParseEq("[\\118]", "[\\x09 8]"); 307 CheckParseEq("[\\118]", "[\\x09 8]");
308 CheckParseEq("[\\111]", "[I]"); 308 CheckParseEq("[\\111]", "[I]");
309 CheckParseEq("[\\1111]", "[I 1]"); 309 CheckParseEq("[\\1111]", "[I 1]");
310 CheckParseEq("\\x34", "'\x34'"); 310 CheckParseEq("\\x34", "'\x34'");
311 CheckParseEq("\\x60", "'\x60'"); 311 CheckParseEq("\\x60", "'\x60'");
312 CheckParseEq("\\x3z", "'x3z'"); 312 CheckParseEq("\\x3z", "'x3z'");
313 CheckParseEq("\\c", "'\\c'"); 313 CheckParseEq("\\c", "'\\c'");
314 CheckParseEq("\\u0034", "'\x34'"); 314 CheckParseEq("\\u0034", "'\x34'");
315 CheckParseEq("\\u003z", "'u003z'"); 315 CheckParseEq("\\u003z", "'u003z'");
316 CheckParseEq("foo[z]*", "(: 'foo' (# 0 - g [z]))"); 316 CheckParseEq("foo[z]*", "(: 'foo' (# 0 - g [z]))");
317 CheckParseEq("^^^$$$\\b\\b\\b\\b", "(: @^i @$i @b)");
318 CheckParseEq("\\b\\b\\b\\b\\B\\B\\B\\B\\b\\b\\b\\b", "(: @b @B @b)");
319 CheckParseEq("\\b\\B\\b", "(: @b @B @b)");
317 320
318 // Unicode regexps 321 // Unicode regexps
319 CheckParseEq("\\u{12345}", "'\\ud808\\udf45'", true); 322 CheckParseEq("\\u{12345}", "'\\ud808\\udf45'", true);
320 CheckParseEq("\\u{12345}\\u{23456}", "(! '\\ud808\\udf45' '\\ud84d\\udc56')", 323 CheckParseEq("\\u{12345}\\u{23456}", "(! '\\ud808\\udf45' '\\ud84d\\udc56')",
321 true); 324 true);
322 CheckParseEq("\\u{12345}|\\u{23456}", "(| '\\ud808\\udf45' '\\ud84d\\udc56')", 325 CheckParseEq("\\u{12345}|\\u{23456}", "(| '\\ud808\\udf45' '\\ud84d\\udc56')",
323 true); 326 true);
324 CheckParseEq("\\u{12345}{3}", "(# 3 3 g '\\ud808\\udf45')", true); 327 CheckParseEq("\\u{12345}{3}", "(# 3 3 g '\\ud808\\udf45')", true);
325 CheckParseEq("\\u{12345}*", "(# 0 - g '\\ud808\\udf45')", true); 328 CheckParseEq("\\u{12345}*", "(# 0 - g '\\ud808\\udf45')", true);
326 329
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 v8::Local<v8::String> external = 2028 v8::Local<v8::String> external =
2026 v8::String::NewExternalOneByte(isolate, new UncachedExternalString()) 2029 v8::String::NewExternalOneByte(isolate, new UncachedExternalString())
2027 .ToLocalChecked(); 2030 .ToLocalChecked();
2028 CHECK(v8::Utils::OpenHandle(*external)->map() == 2031 CHECK(v8::Utils::OpenHandle(*external)->map() ==
2029 CcTest::i_isolate()->heap()->short_external_one_byte_string_map()); 2032 CcTest::i_isolate()->heap()->short_external_one_byte_string_map());
2030 v8::Local<v8::Object> global = env->Global(); 2033 v8::Local<v8::Object> global = env->Global();
2031 global->Set(env.local(), v8_str("external"), external).FromJust(); 2034 global->Set(env.local(), v8_str("external"), external).FromJust();
2032 CompileRun("var re = /y(.)/; re.test('ab');"); 2035 CompileRun("var re = /y(.)/; re.test('ab');");
2033 ExpectString("external.substring(1).match(re)[1]", "z"); 2036 ExpectString("external.substring(1).match(re)[1]", "z");
2034 } 2037 }
OLDNEW
« no previous file with comments | « src/regexp/regexp-parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698