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

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

Issue 10914201: Fix edge case of extension with NULL as source string. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-api.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 2
3 // Check that we can traverse very deep stacks of ConsStrings using 3 // Check that we can traverse very deep stacks of ConsStrings using
4 // StringInputBuffer. Check that Get(int) works on very deep stacks 4 // StringInputBuffer. Check that Get(int) works on very deep stacks
5 // of ConsStrings. These operations may not be very fast, but they 5 // of ConsStrings. These operations may not be very fast, but they
6 // should be possible without getting errors due to too deep recursion. 6 // should be possible without getting errors due to too deep recursion.
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "v8.h" 10 #include "v8.h"
11 11
12 #include "api.h" 12 #include "api.h"
13 #include "factory.h" 13 #include "factory.h"
14 #include "objects.h"
14 #include "cctest.h" 15 #include "cctest.h"
15 #include "zone-inl.h" 16 #include "zone-inl.h"
16 17
17 unsigned int seed = 123; 18 unsigned int seed = 123;
18 19
19 static uint32_t gen() { 20 static uint32_t gen() {
20 uint64_t z; 21 uint64_t z;
21 z = seed; 22 z = seed;
22 z *= 279470273; 23 z *= 279470273;
23 z %= 4294967291U; 24 z %= 4294967291U;
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 "var subject = 'ascii~only~string~'; " 702 "var subject = 'ascii~only~string~'; "
702 "var replace = '\x80'; " 703 "var replace = '\x80'; "
703 "subject.replace(/~/g, replace); "); 704 "subject.replace(/~/g, replace); ");
704 CHECK(result->IsString()); 705 CHECK(result->IsString());
705 Handle<String> string = v8::Utils::OpenHandle(v8::String::Cast(*result)); 706 Handle<String> string = v8::Utils::OpenHandle(v8::String::Cast(*result));
706 CHECK(string->IsSeqTwoByteString()); 707 CHECK(string->IsSeqTwoByteString());
707 708
708 v8::Local<v8::String> expected = v8_str("ascii\x80only\x80string\x80"); 709 v8::Local<v8::String> expected = v8_str("ascii\x80only\x80string\x80");
709 CHECK(expected->Equals(result)); 710 CHECK(expected->Equals(result));
710 } 711 }
712
713
714 TEST(IsAscii) {
715 CHECK(String::IsAscii(static_cast<char*>(NULL), 0));
716 CHECK(String::IsAscii(static_cast<uc16*>(NULL), 0));
717 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698