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

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

Issue 101763003: Replace 'operator*' with explicit 'get' method on SmartPointer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Reupload to make rietveld happy Created 7 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/cctest/test-reloc-info.cc » ('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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 CHECK(result.tree != NULL); 125 CHECK(result.tree != NULL);
126 CHECK(result.error.is_null()); 126 CHECK(result.error.is_null());
127 int min_match = result.tree->min_match(); 127 int min_match = result.tree->min_match();
128 int max_match = result.tree->max_match(); 128 int max_match = result.tree->max_match();
129 MinMaxPair pair = { min_match, max_match }; 129 MinMaxPair pair = { min_match, max_match };
130 return pair; 130 return pair;
131 } 131 }
132 132
133 133
134 #define CHECK_PARSE_ERROR(input) CHECK(!CheckParse(input)) 134 #define CHECK_PARSE_ERROR(input) CHECK(!CheckParse(input))
135 #define CHECK_PARSE_EQ(input, expected) CHECK_EQ(expected, *Parse(input)) 135 #define CHECK_PARSE_EQ(input, expected) CHECK_EQ(expected, Parse(input).get())
136 #define CHECK_SIMPLE(input, simple) CHECK_EQ(simple, CheckSimple(input)); 136 #define CHECK_SIMPLE(input, simple) CHECK_EQ(simple, CheckSimple(input));
137 #define CHECK_MIN_MAX(input, min, max) \ 137 #define CHECK_MIN_MAX(input, min, max) \
138 { MinMaxPair min_max = CheckMinMaxMatch(input); \ 138 { MinMaxPair min_max = CheckMinMaxMatch(input); \
139 CHECK_EQ(min, min_max.min_match); \ 139 CHECK_EQ(min, min_max.min_match); \
140 CHECK_EQ(max, min_max.max_match); \ 140 CHECK_EQ(max, min_max.max_match); \
141 } 141 }
142 142
143 TEST(Parser) { 143 TEST(Parser) {
144 V8::Initialize(NULL); 144 V8::Initialize(NULL);
145 145
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 V8::Initialize(NULL); 392 V8::Initialize(NULL);
393 v8::HandleScope scope(CcTest::isolate()); 393 v8::HandleScope scope(CcTest::isolate());
394 Zone zone(CcTest::i_isolate()); 394 Zone zone(CcTest::i_isolate());
395 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); 395 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
396 RegExpCompileData result; 396 RegExpCompileData result;
397 CHECK(!v8::internal::RegExpParser::ParseRegExp( 397 CHECK(!v8::internal::RegExpParser::ParseRegExp(
398 &reader, false, &result, &zone)); 398 &reader, false, &result, &zone));
399 CHECK(result.tree == NULL); 399 CHECK(result.tree == NULL);
400 CHECK(!result.error.is_null()); 400 CHECK(!result.error.is_null());
401 SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS); 401 SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS);
402 CHECK_EQ(expected, *str); 402 CHECK_EQ(expected, str.get());
403 } 403 }
404 404
405 405
406 TEST(Errors) { 406 TEST(Errors) {
407 const char* kEndBackslash = "\\ at end of pattern"; 407 const char* kEndBackslash = "\\ at end of pattern";
408 ExpectError("\\", kEndBackslash); 408 ExpectError("\\", kEndBackslash);
409 const char* kUnterminatedGroup = "Unterminated group"; 409 const char* kUnterminatedGroup = "Unterminated group";
410 ExpectError("(foo", kUnterminatedGroup); 410 ExpectError("(foo", kUnterminatedGroup);
411 const char* kInvalidGroup = "Invalid group"; 411 const char* kInvalidGroup = "Invalid group";
412 ExpectError("(?", kInvalidGroup); 412 ExpectError("(?", kInvalidGroup);
(...skipping 10 matching lines...) Expand all
423 423
424 // Check that we don't allow more than kMaxCapture captures 424 // Check that we don't allow more than kMaxCapture captures
425 const int kMaxCaptures = 1 << 16; // Must match RegExpParser::kMaxCaptures. 425 const int kMaxCaptures = 1 << 16; // Must match RegExpParser::kMaxCaptures.
426 const char* kTooManyCaptures = "Too many captures"; 426 const char* kTooManyCaptures = "Too many captures";
427 HeapStringAllocator allocator; 427 HeapStringAllocator allocator;
428 StringStream accumulator(&allocator); 428 StringStream accumulator(&allocator);
429 for (int i = 0; i <= kMaxCaptures; i++) { 429 for (int i = 0; i <= kMaxCaptures; i++) {
430 accumulator.Add("()"); 430 accumulator.Add("()");
431 } 431 }
432 SmartArrayPointer<const char> many_captures(accumulator.ToCString()); 432 SmartArrayPointer<const char> many_captures(accumulator.ToCString());
433 ExpectError(*many_captures, kTooManyCaptures); 433 ExpectError(many_captures.get(), kTooManyCaptures);
434 } 434 }
435 435
436 436
437 static bool IsDigit(uc16 c) { 437 static bool IsDigit(uc16 c) {
438 return ('0' <= c && c <= '9'); 438 return ('0' <= c && c <= '9');
439 } 439 }
440 440
441 441
442 static bool NotDigit(uc16 c) { 442 static bool NotDigit(uc16 c) {
443 return !IsDigit(c); 443 return !IsDigit(c);
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 ZoneList<CharacterRange> first_only(4, &zone); 1809 ZoneList<CharacterRange> first_only(4, &zone);
1810 ZoneList<CharacterRange> second_only(4, &zone); 1810 ZoneList<CharacterRange> second_only(4, &zone);
1811 ZoneList<CharacterRange> both(4, &zone); 1811 ZoneList<CharacterRange> both(4, &zone);
1812 } 1812 }
1813 1813
1814 1814
1815 TEST(Graph) { 1815 TEST(Graph) {
1816 V8::Initialize(NULL); 1816 V8::Initialize(NULL);
1817 Execute("\\b\\w+\\b", false, true, true); 1817 Execute("\\b\\w+\\b", false, true, true);
1818 } 1818 }
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/cctest/test-reloc-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698