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

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

Issue 115014: Port change (r1837) that allows call-as-function handlers to be called... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 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/arm/codegen-arm.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 1873)
+++ test/cctest/test-api.cc (working copy)
@@ -4627,35 +4627,42 @@
Local<Value> value;
CHECK(!try_catch.HasCaught());
- value = Script::Compile(v8_str("obj(42)"))->Run();
+ value = CompileRun("obj(42)");
CHECK(!try_catch.HasCaught());
CHECK_EQ(42, value->Int32Value());
- value = Script::Compile(v8_str("(function(o){return o(49)})(obj)"))->Run();
+ value = CompileRun("(function(o){return o(49)})(obj)");
CHECK(!try_catch.HasCaught());
CHECK_EQ(49, value->Int32Value());
// test special case of call as function
- value = Script::Compile(v8_str("[obj]['0'](45)"))->Run();
+ value = CompileRun("[obj]['0'](45)");
CHECK(!try_catch.HasCaught());
CHECK_EQ(45, value->Int32Value());
- value = Script::Compile(v8_str("obj.call = Function.prototype.call;"
- "obj.call(null, 87)"))->Run();
+ value = CompileRun("obj.call = Function.prototype.call;"
+ "obj.call(null, 87)");
CHECK(!try_catch.HasCaught());
CHECK_EQ(87, value->Int32Value());
// Regression tests for bug #1116356: Calling call through call/apply
// must work for non-function receivers.
const char* apply_99 = "Function.prototype.call.apply(obj, [this, 99])";
- value = Script::Compile(v8_str(apply_99))->Run();
+ value = CompileRun(apply_99);
CHECK(!try_catch.HasCaught());
CHECK_EQ(99, value->Int32Value());
const char* call_17 = "Function.prototype.call.call(obj, this, 17)";
- value = Script::Compile(v8_str(call_17))->Run();
+ value = CompileRun(call_17);
CHECK(!try_catch.HasCaught());
CHECK_EQ(17, value->Int32Value());
+
+ // Check that the call-as-function handler can be called through
+ // new. Currently, there is no way to check in the call-as-function
+ // handler if it has been called through new or not.
+ value = CompileRun("new obj(42)");
+ CHECK(!try_catch.HasCaught());
+ CHECK_EQ(42, value->Int32Value());
}
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698