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

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

Issue 1994973002: Revert of Refactor script position calculation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/runtime/runtime-debug.cc ('k') | test/cctest/test-debug.cc » ('j') | 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 9078fad2ff4738ffb51d1a7cddd88d7957a63fa3..5db8321db414e78a8f9eb8687511cd22c2103247 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -23408,88 +23408,6 @@
CHECK_EQ(13, line_number);
}
-TEST(ScriptPositionInfo) {
- 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;\n"
- "var bar;\n"
- "var fisk = foo + bar;\n"),
- origin);
- Local<Script> script =
- v8::ScriptCompiler::Compile(env.local(), &script_source).ToLocalChecked();
-
- i::Handle<i::SharedFunctionInfo> obj = i::Handle<i::SharedFunctionInfo>::cast(
- v8::Utils::OpenHandle(*script->GetUnboundScript()));
- CHECK(obj->script()->IsScript());
-
- i::Handle<i::Script> script1(i::Script::cast(obj->script()));
-
- v8::internal::Script::PositionInfo info;
-
- // With offset.
-
- // Behave as if 0 was passed if position is negative.
- CHECK(script1->GetPositionInfo(-1, &info, script1->kWithOffset));
- CHECK_EQ(13, info.line);
- CHECK_EQ(0, info.column);
- CHECK_EQ(0, info.line_start);
- CHECK_EQ(8, info.line_end);
-
- CHECK(script1->GetPositionInfo(0, &info, script1->kWithOffset));
- CHECK_EQ(13, info.line);
- CHECK_EQ(0, info.column);
- CHECK_EQ(0, info.line_start);
- CHECK_EQ(8, info.line_end);
-
- CHECK(script1->GetPositionInfo(8, &info, script1->kWithOffset));
- CHECK_EQ(13, info.line);
- CHECK_EQ(8, info.column);
- CHECK_EQ(0, info.line_start);
- CHECK_EQ(8, info.line_end);
-
- CHECK(script1->GetPositionInfo(9, &info, script1->kWithOffset));
- CHECK_EQ(14, info.line);
- CHECK_EQ(0, info.column);
- CHECK_EQ(9, info.line_start);
- CHECK_EQ(17, info.line_end);
-
- // Fail when position is larger than script size.
- CHECK(!script1->GetPositionInfo(220384, &info, script1->kWithOffset));
-
- // Without offset.
-
- // Behave as if 0 was passed if position is negative.
- CHECK(script1->GetPositionInfo(-1, &info, script1->kNoOffset));
- CHECK_EQ(0, info.line);
- CHECK_EQ(0, info.column);
- CHECK_EQ(0, info.line_start);
- CHECK_EQ(8, info.line_end);
-
- CHECK(script1->GetPositionInfo(0, &info, script1->kNoOffset));
- CHECK_EQ(0, info.line);
- CHECK_EQ(0, info.column);
- CHECK_EQ(0, info.line_start);
- CHECK_EQ(8, info.line_end);
-
- CHECK(script1->GetPositionInfo(8, &info, script1->kNoOffset));
- CHECK_EQ(0, info.line);
- CHECK_EQ(8, info.column);
- CHECK_EQ(0, info.line_start);
- CHECK_EQ(8, info.line_end);
-
- CHECK(script1->GetPositionInfo(9, &info, script1->kNoOffset));
- CHECK_EQ(1, info.line);
- CHECK_EQ(0, info.column);
- CHECK_EQ(9, info.line_start);
- CHECK_EQ(17, info.line_end);
-
- // Fail when position is larger than script size.
- CHECK(!script1->GetPositionInfo(220384, &info, script1->kNoOffset));
-}
-
void CheckMagicComments(Local<Script> script, const char* expected_source_url,
const char* expected_source_mapping_url) {
if (expected_source_url != NULL) {
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698