Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index e8c3b0d00d01cf85cf62b3b2c35d10e71ee847a7..447437541ef935d8d0e58f2e7e60f7937a52f4f1 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -22613,3 +22613,22 @@ TEST(CaptureStackTraceForStackOverflow) { |
CompileRun("(function f(x) { f(x+1); })(0)"); |
CHECK(try_catch.HasCaught()); |
} |
+ |
+ |
+TEST(ScriptNameAndLineNumber) { |
+ LocalContext env; |
+ v8::Isolate* isolate = env->GetIsolate(); |
+ v8::HandleScope scope(isolate); |
+ const char* url = "http://www.foo.com/foo.js"; |
+ v8::ScriptOrigin origin(v8_str(url), v8::Integer::New(isolate, 13)); |
+ v8::ScriptCompiler::Source script_source(v8_str("var foo;"), origin); |
+ Local<Script> script = v8::ScriptCompiler::Compile( |
+ isolate, &script_source); |
+ Local<Value> script_name = script->GetUnboundScript()->GetScriptName(); |
+ CHECK(!script_name.IsEmpty()); |
+ CHECK(script_name->IsString()); |
+ String::Utf8Value utf8_name(script_name); |
+ CHECK_EQ(url, *utf8_name); |
+ int line_number = script->GetUnboundScript()->GetLineNumber(0); |
+ CHECK_EQ(13, line_number); |
+} |