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

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

Issue 3330001: Fix parsing of /**/--> on first line of input. (Closed)
Patch Set: Added test-case. Created 10 years, 4 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/scanner.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
+}
« no previous file with comments | « src/scanner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698