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

Unified Diff: test/cctest/test-api.cc

Issue 271085: - Add String::Concat(Handle<String> left, Handle<String> right) to the V8 API... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 3058)
+++ test/cctest/test-api.cc (working copy)
@@ -572,6 +572,44 @@
}
+THREADED_TEST(StringConcat) {
+ {
+ v8::HandleScope scope;
+ LocalContext env;
+ const char* one_byte_string_1 = "function a_times_t";
+ const char* two_byte_string_1 = "wo_plus_b(a, b) {return ";
+ const char* one_byte_extern_1 = "a * 2 + b;} a_times_two_plus_b(4, 8) + ";
+ const char* two_byte_extern_1 = "a_times_two_plus_b(4, 8) + ";
+ const char* one_byte_string_2 = "a_times_two_plus_b(4, 8) + ";
+ const char* two_byte_string_2 = "a_times_two_plus_b(4, 8) + ";
+ const char* two_byte_extern_2 = "a_times_two_plus_b(1, 2);";
+ Local<String> left = v8_str(one_byte_string_1);
+ Local<String> right = String::New(AsciiToTwoByteString(two_byte_string_1));
+ Local<String> source = String::Concat(left, right);
+ right = String::NewExternal(
+ new TestAsciiResource(i::StrDup(one_byte_extern_1)));
+ source = String::Concat(source, right);
+ right = String::NewExternal(
+ new TestResource(AsciiToTwoByteString(two_byte_extern_1)));
+ source = String::Concat(source, right);
+ right = v8_str(one_byte_string_2);
+ source = String::Concat(source, right);
+ right = String::New(AsciiToTwoByteString(two_byte_string_2));
+ source = String::Concat(source, right);
+ right = String::NewExternal(
+ new TestResource(AsciiToTwoByteString(two_byte_extern_2)));
+ source = String::Concat(source, right);
+ Local<Script> script = Script::Compile(source);
+ Local<Value> value = script->Run();
+ CHECK(value->IsNumber());
+ CHECK_EQ(68, value->Int32Value());
+ }
+ v8::internal::CompilationCache::Clear();
+ i::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
+}
+
+
THREADED_TEST(GlobalProperties) {
v8::HandleScope scope;
LocalContext env;
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698