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

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

Issue 11397: Fixed bug 129 (Closed)
Patch Set: 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
« no previous file with comments | « src/unicode.cc ('k') | test/mjsunit/regress/regress-149.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 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 ExpectError("(foo", kUnterminatedGroup); 267 ExpectError("(foo", kUnterminatedGroup);
268 const char* kInvalidGroup = "Invalid group"; 268 const char* kInvalidGroup = "Invalid group";
269 ExpectError("(?", kInvalidGroup); 269 ExpectError("(?", kInvalidGroup);
270 const char* kUnterminatedCharacterClass = "Unterminated character class"; 270 const char* kUnterminatedCharacterClass = "Unterminated character class";
271 ExpectError("[", kUnterminatedCharacterClass); 271 ExpectError("[", kUnterminatedCharacterClass);
272 ExpectError("[a-", kUnterminatedCharacterClass); 272 ExpectError("[a-", kUnterminatedCharacterClass);
273 const char* kIllegalCharacterClass = "Illegal character class"; 273 const char* kIllegalCharacterClass = "Illegal character class";
274 ExpectError("[a-\\w]", kIllegalCharacterClass); 274 ExpectError("[a-\\w]", kIllegalCharacterClass);
275 const char* kEndControl = "\\c at end of pattern"; 275 const char* kEndControl = "\\c at end of pattern";
276 ExpectError("\\c", kEndControl); 276 ExpectError("\\c", kEndControl);
277 static char* kNothingToRepeat = "Nothing to repeat"; 277 static const char* kNothingToRepeat = "Nothing to repeat";
Lasse Reichstein 2008/11/24 14:08:57 Why static? The rest of the const char* variables
278 ExpectError("*", kNothingToRepeat); 278 ExpectError("*", kNothingToRepeat);
279 ExpectError("?", kNothingToRepeat); 279 ExpectError("?", kNothingToRepeat);
280 ExpectError("+", kNothingToRepeat); 280 ExpectError("+", kNothingToRepeat);
281 ExpectError("{1}", kNothingToRepeat); 281 ExpectError("{1}", kNothingToRepeat);
282 ExpectError("{1,2}", kNothingToRepeat); 282 ExpectError("{1,2}", kNothingToRepeat);
283 ExpectError("{1,}", kNothingToRepeat); 283 ExpectError("{1,}", kNothingToRepeat);
284 } 284 }
285 285
286 286
287 static bool IsDigit(uc16 c) { 287 static bool IsDigit(uc16 c) {
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> un_canonicalize; 773 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> un_canonicalize;
774 for (char lower = 'a'; lower <= 'z'; lower++) { 774 for (char lower = 'a'; lower <= 'z'; lower++) {
775 char upper = lower + ('A' - 'a'); 775 char upper = lower + ('A' - 'a');
776 CHECK_EQ(canonicalize(lower), canonicalize(upper)); 776 CHECK_EQ(canonicalize(lower), canonicalize(upper));
777 unibrow::uchar uncanon[unibrow::Ecma262UnCanonicalize::kMaxWidth]; 777 unibrow::uchar uncanon[unibrow::Ecma262UnCanonicalize::kMaxWidth];
778 int length = un_canonicalize.get(lower, '\0', uncanon); 778 int length = un_canonicalize.get(lower, '\0', uncanon);
779 CHECK_EQ(2, length); 779 CHECK_EQ(2, length);
780 CHECK_EQ(upper, uncanon[0]); 780 CHECK_EQ(upper, uncanon[0]);
781 CHECK_EQ(lower, uncanon[1]); 781 CHECK_EQ(lower, uncanon[1]);
782 } 782 }
783 for (uc32 c = 128; c < (1 << 21); c++) { 783 for (uc32 c = 128; c < (1 << 21); c++)
784 // These exceptions are caused by a known bug in the implementation. 784 CHECK_GE(canonicalize(c), 128);
785 if (c != 0x026B && c != 0x027D)
786 CHECK_GE(canonicalize(c), 128);
787 }
788 unibrow::Mapping<unibrow::ToUppercase> to_upper; 785 unibrow::Mapping<unibrow::ToUppercase> to_upper;
789 for (uc32 c = 0; c < (1 << 21); c++) { 786 for (uc32 c = 0; c < (1 << 21); c++) {
790 if (c == 0x026B || c == 0x027D) continue;
791 unibrow::uchar upper[unibrow::ToUppercase::kMaxWidth]; 787 unibrow::uchar upper[unibrow::ToUppercase::kMaxWidth];
792 int length = to_upper.get(c, '\0', upper); 788 int length = to_upper.get(c, '\0', upper);
793 if (length == 0) { 789 if (length == 0) {
794 length = 1; 790 length = 1;
795 upper[0] = c; 791 upper[0] = c;
796 } 792 }
797 uc32 u = upper[0]; 793 uc32 u = upper[0];
798 if (length > 1 || (c >= 128 && u < 128)) 794 if (length > 1 || (c >= 128 && u < 128))
799 u = c; 795 u = c;
800 if (u != canonicalize(c))
801 printf("%x\n", c);
802 CHECK_EQ(u, canonicalize(c)); 796 CHECK_EQ(u, canonicalize(c));
803 } 797 }
804 } 798 }
805 799
806 800
807 TEST(SimplePropagation) { 801 TEST(SimplePropagation) {
808 v8::HandleScope scope; 802 v8::HandleScope scope;
809 ZoneScope zone_scope(DELETE_ON_EXIT); 803 ZoneScope zone_scope(DELETE_ON_EXIT);
810 RegExpNode* node = Compile("(a|^b|c)"); 804 RegExpNode* node = Compile("(a|^b|c)");
811 CHECK(node->info()->determine_start); 805 CHECK(node->info()->determine_start);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 // whole block at a time. 912 // whole block at a time.
919 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), 913 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'),
920 CharacterRange('a', 'z')); 914 CharacterRange('a', 'z'));
921 } 915 }
922 916
923 917
924 TEST(Graph) { 918 TEST(Graph) {
925 V8::Initialize(NULL); 919 V8::Initialize(NULL);
926 Execute("(x)?\\1y", "", true); 920 Execute("(x)?\\1y", "", true);
927 } 921 }
OLDNEW
« no previous file with comments | « src/unicode.cc ('k') | test/mjsunit/regress/regress-149.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698