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

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

Issue 10759: Introduce text nodes (Closed)
Patch Set: Fixed repeated RemoveLast issue Created 12 years, 1 month 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
« src/parser.cc ('K') | « 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
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 CHECK_PARSE_EQ("[\\011]", "[\t]"); 167 CHECK_PARSE_EQ("[\\011]", "[\t]");
168 CHECK_PARSE_EQ("[\\00011]", "[\000 1 1]"); 168 CHECK_PARSE_EQ("[\\00011]", "[\000 1 1]");
169 CHECK_PARSE_EQ("[\\118]", "[\t 8]"); 169 CHECK_PARSE_EQ("[\\118]", "[\t 8]");
170 CHECK_PARSE_EQ("[\\111]", "[I]"); 170 CHECK_PARSE_EQ("[\\111]", "[I]");
171 CHECK_PARSE_EQ("[\\1111]", "[I 1]"); 171 CHECK_PARSE_EQ("[\\1111]", "[I 1]");
172 CHECK_PARSE_EQ("\\x34", "'\x34'"); 172 CHECK_PARSE_EQ("\\x34", "'\x34'");
173 CHECK_PARSE_EQ("\\x60", "'\x60'"); 173 CHECK_PARSE_EQ("\\x60", "'\x60'");
174 CHECK_PARSE_EQ("\\x3z", "'x3z'"); 174 CHECK_PARSE_EQ("\\x3z", "'x3z'");
175 CHECK_PARSE_EQ("\\u0034", "'\x34'"); 175 CHECK_PARSE_EQ("\\u0034", "'\x34'");
176 CHECK_PARSE_EQ("\\u003z", "'u003z'"); 176 CHECK_PARSE_EQ("\\u003z", "'u003z'");
177 CHECK_PARSE_EQ("foo[z]*", "(: 'foo' (# 0 - g [z]))");
177 178
178 CHECK_ESCAPES("a", false); 179 CHECK_ESCAPES("a", false);
179 CHECK_ESCAPES("a|b", false); 180 CHECK_ESCAPES("a|b", false);
180 CHECK_ESCAPES("a\\n", true); 181 CHECK_ESCAPES("a\\n", true);
181 CHECK_ESCAPES("^a", false); 182 CHECK_ESCAPES("^a", false);
182 CHECK_ESCAPES("a$", false); 183 CHECK_ESCAPES("a$", false);
183 CHECK_ESCAPES("a\\b!", false); 184 CHECK_ESCAPES("a\\b!", false);
184 CHECK_ESCAPES("a\\Bb", false); 185 CHECK_ESCAPES("a\\Bb", false);
185 CHECK_ESCAPES("a*", false); 186 CHECK_ESCAPES("a*", false);
186 CHECK_ESCAPES("a*?", false); 187 CHECK_ESCAPES("a*?", false);
(...skipping 25 matching lines...) Expand all
212 CHECK_ESCAPES("\\x60", true); 213 CHECK_ESCAPES("\\x60", true);
213 CHECK_ESCAPES("\\u0060", true); 214 CHECK_ESCAPES("\\u0060", true);
214 CHECK_ESCAPES("\\cA", true); 215 CHECK_ESCAPES("\\cA", true);
215 CHECK_ESCAPES("\\q", true); 216 CHECK_ESCAPES("\\q", true);
216 CHECK_ESCAPES("\\1112", true); 217 CHECK_ESCAPES("\\1112", true);
217 CHECK_ESCAPES("\\0", true); 218 CHECK_ESCAPES("\\0", true);
218 CHECK_ESCAPES("(a)\\1", false); 219 CHECK_ESCAPES("(a)\\1", false);
219 } 220 }
220 221
221 TEST(ParserRegression) { 222 TEST(ParserRegression) {
222 CHECK_PARSE_EQ("[A-Z$-][x]", "(: [A-Z $ -] [x])"); 223 CHECK_PARSE_EQ("[A-Z$-][x]", "(! [A-Z $ -] [x])");
223 } 224 }
224 225
225 static void ExpectError(const char* input, 226 static void ExpectError(const char* input,
226 const char* expected) { 227 const char* expected) {
227 v8::HandleScope scope; 228 v8::HandleScope scope;
228 unibrow::Utf8InputBuffer<> buffer(input, strlen(input)); 229 unibrow::Utf8InputBuffer<> buffer(input, strlen(input));
229 ZoneScope zone_scope(DELETE_ON_EXIT); 230 ZoneScope zone_scope(DELETE_ON_EXIT);
230 RegExpParseResult result; 231 RegExpParseResult result;
231 CHECK_EQ(false, v8::internal::ParseRegExp(&buffer, &result)); 232 CHECK_EQ(false, v8::internal::ParseRegExp(&buffer, &result));
232 CHECK(result.tree == NULL); 233 CHECK(result.tree == NULL);
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 DispatchTable table; 701 DispatchTable table;
701 DispatchTableConstructor cons(&table); 702 DispatchTableConstructor cons(&table);
702 cons.set_choice_index(0); 703 cons.set_choice_index(0);
703 cons.AddInverse(ranges); 704 cons.AddInverse(ranges);
704 CHECK(!table.Get(0xFFFE)->Get(0)); 705 CHECK(!table.Get(0xFFFE)->Get(0));
705 CHECK(table.Get(0xFFFF)->Get(0)); 706 CHECK(table.Get(0xFFFF)->Get(0));
706 } 707 }
707 708
708 709
709 TEST(Graph) { 710 TEST(Graph) {
710 Execute("a|(b|c)|d", "", true); 711 Execute("fo[ob]ar|[ba]z|x[yz]*", "", true);
711 } 712 }
OLDNEW
« src/parser.cc ('K') | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698