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

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

Issue 2451853002: Uniform and precise source positions for inlining (Closed)
Patch Set: fixed gcmole issue Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 6c0655a8f49eff801e5ba69e6e7a60205436d8ce..679fd94459c83e2066c5651549e9749398b24210 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -24123,65 +24123,69 @@ TEST(ScriptPositionInfo) {
v8::internal::Script::PositionInfo info;
- // With offset.
-
- // Behave as if 0 was passed if position is negative.
- CHECK(script1->GetPositionInfo(-1, &info, script1->WITH_OFFSET));
- 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->WITH_OFFSET));
- 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->WITH_OFFSET));
- 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->WITH_OFFSET));
- 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->WITH_OFFSET));
-
- // Without offset.
-
- // Behave as if 0 was passed if position is negative.
- CHECK(script1->GetPositionInfo(-1, &info, script1->NO_OFFSET));
- 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->NO_OFFSET));
- 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->NO_OFFSET));
- 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->NO_OFFSET));
- 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->NO_OFFSET));
+ for (int i = 0; i < 2; ++i) {
+ // With offset.
+
+ // Behave as if 0 was passed if position is negative.
+ CHECK(script1->GetPositionInfo(-1, &info, script1->WITH_OFFSET));
+ 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->WITH_OFFSET));
+ 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->WITH_OFFSET));
+ 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->WITH_OFFSET));
+ 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->WITH_OFFSET));
+
+ // Without offset.
+
+ // Behave as if 0 was passed if position is negative.
+ CHECK(script1->GetPositionInfo(-1, &info, script1->NO_OFFSET));
+ 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->NO_OFFSET));
+ 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->NO_OFFSET));
+ 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->NO_OFFSET));
+ 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->NO_OFFSET));
+
+ i::Script::InitLineEnds(script1);
+ }
}
void CheckMagicComments(Local<Script> script, const char* expected_source_url,

Powered by Google App Engine
This is Rietveld 408576698