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

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

Issue 106763002: Get information about original function from bound function (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code review response Created 7 years 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
« src/api.cc ('K') | « 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
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 91f37367dae9d0ec815cbd4738bc62484e1df80f..814c03fa3e334bb47e1b64b310ede7adb82ed620 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -17836,6 +17836,29 @@ THREADED_TEST(FunctionGetScriptId) {
}
+THREADED_TEST(FunctionGetBoundFunction) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::NewFromUtf8(
+ env->GetIsolate(), "test"));
+ v8::Handle<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(),
+ "function f () {}\n"
+ "var g = f.bind();\n");
yurys 2013/12/18 10:10:14 Maybe add some arguments to make sure this is not
Alexandra Mikhaylova 2013/12/18 14:16:07 Done.
+ v8::Script::Compile(script, &origin)->Run();
+ v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
+ v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
+ CHECK(g->GetBoundFunction()->IsFunction());
+ Local<v8::Function> g_original = Local<v8::Function>::Cast(
yurys 2013/12/18 10:10:14 g_original -> original_function?
Alexandra Mikhaylova 2013/12/18 14:16:07 Done.
+ g->GetBoundFunction());
+ CHECK_EQ(f->GetName(), g_original->GetName());
+ CHECK_EQ(f->GetScriptLineNumber(), g_original->GetScriptLineNumber());
+ CHECK_EQ(f->GetScriptColumnNumber(), g_original->GetScriptColumnNumber());
+}
+
+
static void GetterWhichReturns42(
Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698