Chromium Code Reviews| Index: test/cctest/test-strings.cc |
| diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc |
| index 59a40af2a675c586df40e2f41dde5cf2955dfe27..d20a57764ef30145bfe4c501bdcb59b697931453 100644 |
| --- a/test/cctest/test-strings.cc |
| +++ b/test/cctest/test-strings.cc |
| @@ -344,6 +344,38 @@ TEST(Utf8Conversion) { |
| } |
| +TEST(StringConcatFlatten) { |
| + InitializeVM(); |
| + v8::HandleScope handle_scope; |
| + |
| + const char* stringA = "0123456789"; |
| + const char* stringB = "ABCDEFGHIJ"; |
| + |
| + v8::Local<v8::String> a = v8::String::New(stringA); |
| + v8::Local<v8::String> b = v8::String::New(stringB); |
| + |
| + v8::Local<v8::String> cons = v8::String::Concat(a,b); |
| + |
| + i::Handle<i::String> str = v8::Utils::OpenHandle(*cons); |
| + CHECK_EQ(false, str->IsFlat()); |
|
antonm
2010/04/08 11:23:41
would you mind if I change that to CHECK(!str->IsF
|
| + |
| + cons->Flatten(); |
| + |
| + CHECK_EQ(true, str->IsFlat()); |
|
antonm
2010/04/08 11:23:41
would you mind if I change that to CHECK(str->IsFl
|
| + |
| + char buffer[21]; |
| + cons->WriteUtf8(buffer); |
| + |
| + for (int j = 0; j < 10; j++) { |
|
antonm
2010/04/08 11:23:41
why j, not i? :) I could change to i when landing
|
| + CHECK_EQ(stringA[j], buffer[j]); |
| + } |
| + |
| + for (int j = 0; j < 10; j++) { |
| + CHECK_EQ(stringB[j], buffer[j+10]); |
| + } |
| +} |
| + |
| + |
| TEST(ExternalShortStringAdd) { |
| ZoneScope zone(DELETE_ON_EXIT); |