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

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: Make ObjectProtoToString() work like ES6 Object.prototype.toString-ish 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]")));
caitp (gmail) 2014/10/17 22:00:49 These tests are not very robust and don't cover th
Dmitry Lomov (no reviews) 2014/10/18 08:41:49 More tests is always good. Maybe you can reduce th
caitp (gmail) 2014/10/18 13:34:35 Yeah, most of the stuff being tested isn't intern'
}
« src/api.cc ('K') | « src/weak-collection.js ('k') | test/mjsunit/es6/collections.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698