Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index d62b6a5d537d9e13fa1ae54d23e307bd50ed6f7d..ed0c8b52f4e59e86a775440674dcbd701e9f6aec 100755 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -32,6 +32,7 @@ |
#include "token.h" |
#include "scanner.h" |
#include "utils.h" |
+#include "execution.h" |
#include "cctest.h" |
@@ -127,3 +128,35 @@ TEST(KeywordMatcher) { |
CHECK_EQ(i::Token::IDENTIFIER, full_stop.token()); |
} |
+ |
+TEST(ScanHTMLEndComments) { |
+ // Regression test. See: |
+ // http://code.google.com/p/chromium/issues/detail?id=53548 |
+ // Tests that --> is correctly interpreted as comment-to-end-of-line if there |
+ // is only whitespace before it on the line, even after a multiline-comment |
+ // comment. This was not the case if it occurred before the first real token |
+ // in the input. |
+ const char* tests[] = { |
+ // Before first real token. |
+ "--> is eol-comment\nvar y = 37;\n", |
+ "\n --> is eol-comment\nvar y = 37;\n", |
+ "/* precomment */ --> is eol-comment\nvar y = 37;\n", |
+ "\n/* precomment */ --> is eol-comment\nvar y = 37;\n", |
+ // After first real token. |
+ "var x = 42;\n--> is eol-comment\nvar y = 37;\n", |
+ "var x = 42;\n/* precomment */ --> is eol-comment\nvar y = 37;\n", |
+ NULL |
+ }; |
+ |
+ // Parser needs a stack limit. |
+ int marker; |
+ i::StackGuard::SetStackLimit( |
+ reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); |
+ |
+ for (int i = 0; tests[i]; i++) { |
+ v8::ScriptData* data = |
+ v8::ScriptData::PreCompile(tests[i], strlen(tests[i])); |
+ CHECK(data != NULL && !data->HasError()); |
+ delete data; |
+ } |
+} |