Chromium Code Reviews

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

Issue 265593002: Add v8::Message::GetScriptOrigin() with tests (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« 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 5f82bd7f2e7ee184975588e4de3e6b7fcebbe325..aa37c3afe0aecb2b529f7cc1378bf75e5cf3f236 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -17681,6 +17681,46 @@ TEST(DynamicWithSourceURLInStackTraceString) {
}
+TEST(EvalWithSourceURLInStackTraceString) {
+ LocalContext context;
+ v8::HandleScope scope(context->GetIsolate());
+
+ const char *source =
+ "function outer() {\n"
+ " var scriptContents = \"function foo() { FAIL.FAIL; } "
+ "//# sourceURL=foo2.js\";\n"
vsevik 2014/04/30 10:18:40 could you please break this string (e.g. "//# sour
kozyatinskiy1 2014/04/30 15:46:43 Done.
+ " eval(scriptContents); \n"
+ " foo(); }\n"
+ "outer();\n";
+
+ v8::TryCatch try_catch;
+ CompileRun(source);
+ CHECK(try_catch.HasCaught());
+ v8::String::Utf8Value stack(try_catch.StackTrace());
vsevik 2014/04/30 10:18:40 StackTrace does not use your new method, so this t
+ CHECK(strstr(*stack, "at foo (foo2.js:1:18)") != NULL);
+}
+
+
+TEST(RecursionWithSourceURLInStackTraceString) {
+ LocalContext context;
+ v8::HandleScope scope(context->GetIsolate());
+
+ const char *source =
+ "function outer() {\n"
+ " var scriptContents = \"function boo(){ boo(); }"
+ " function foo() { boo(); } //# sourceURL=foo2.js\";\n"
+ " eval(scriptContents);\n"
+ " foo(); }\n"
+ "outer();\n";
+
+ v8::TryCatch try_catch;
+ CompileRun(source);
+ CHECK(try_catch.HasCaught());
+ v8::String::Utf8Value stack(try_catch.StackTrace());
vsevik 2014/04/30 10:18:40 ditto
kozyatinskiy1 2014/04/30 15:46:43 Done.
+ CHECK(strstr(*stack, "at boo (foo2.js:1:13)") != NULL);
+}
+
+
static void CreateGarbageInOldSpace() {
i::Factory* factory = CcTest::i_isolate()->factory();
v8::HandleScope scope(CcTest::isolate());
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine