Author: [EMAIL PROTECTED]
Date: Mon Nov 17 23:32:38 2008
New Revision: 779
Modified:
branches/bleeding_edge/test/cctest/test-api.cc
Log:
Add an API test for v8::ScriptData::PreCompile() to make sure
that v8::V8::Initialize() does not have to be called to allow
pre-compilation. Currently this test would fail, which is
why a workaround has been applied and a bug filed.
Review URL: http://codereview.chromium.org/11441
Modified: branches/bleeding_edge/test/cctest/test-api.cc
==============================================================================
--- branches/bleeding_edge/test/cctest/test-api.cc (original)
+++ branches/bleeding_edge/test/cctest/test-api.cc Mon Nov 17 23:32:38 2008
@@ -5274,3 +5274,17 @@
value = CompileRun("obj.externalSymbol722 = 42");
v8::V8::SetExternalSymbolCallback(NULL);
}
+
+
+// This test verifies that pre-compilation (aka preparsing) can be called
+// without initializing the whole VM. Thus we cannot run this test in a
+// multi-threaded setup.
+TEST(PreCompile) {
+ // TODO(155): This test would break without the initialization of V8.
This is
+ // a workaround for now to make this test not fail.
+ v8::V8::Initialize();
+ const char *script = "function foo(a) { return a+1; }";
+ v8::ScriptData *sd = v8::ScriptData::PreCompile(script, strlen(script));
+ CHECK_NE(sd->Length(), 0);
+ CHECK_NE(sd->Data(), NULL);
+}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---