OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |