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

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

Issue 546803003: Update ObjectToString to Harmony-draft algorithm (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use intern'd strings instead of creating vectors Created 6 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
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 283bcb8e0d66d869a7faf3751d761b5a3fb5a3c3..dceb2a507f76ba3a6afe55838a00cd91acf12108 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -13489,6 +13489,20 @@ THREADED_TEST(ObjectProtoToString) {
Local<Value> object = v8_compile("new Object()")->Run();
value = object.As<v8::Object>()->ObjectProtoToString();
CHECK(value->IsString() && value->Equals(v8_str("[object Object]")));
+
+ // Check that ES6 semantics using @@toStringTag work
+ i::FLAG_harmony_tostring = true;
+ Local<v8::Symbol> toStringTag = v8::Symbol::GetToStringTag(isolate);
+
+ object = v8_compile("new Object()")->Run();
+ object.As<v8::Object>()->Set(toStringTag, v8_str("Foo"));
+ value = object.As<v8::Object>()->ObjectProtoToString();
+ CHECK(value->IsString() && value->Equals(v8_str("[object Foo]")));
+
+ object = v8_compile("new Object()")->Run();
+ object.As<v8::Object>()->Set(toStringTag, v8_str("Array"));
+ value = object.As<v8::Object>()->ObjectProtoToString();
+ CHECK(value->IsString() && value->Equals(v8_str("[object ~Array]")));
Dmitry Lomov (no reviews) 2014/10/18 15:16:48 Add a test that creates an object with a getter fo
}

Powered by Google App Engine
This is Rietveld 408576698