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, |