Index: test/cctest/test-parsing.cc |
=================================================================== |
--- test/cctest/test-parsing.cc (revision 8352) |
+++ test/cctest/test-parsing.cc (working copy) |
@@ -137,8 +137,9 @@ |
// 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 |
+ // is only whitespace before it on the line (with comments considered as |
+ // whitespace, even a multiline-comment containing a newline). |
+ // This was not the case if it occurred before the first real token |
// in the input. |
const char* tests[] = { |
// Before first real token. |
@@ -152,6 +153,16 @@ |
NULL |
}; |
+ const char* fail_tests[] = { |
+ "x --> is eol-comment\nvar y = 37;\n", |
+ "\"\\n\" --> is eol-comment\nvar y = 37;\n", |
+ "x/* precomment */ --> is eol-comment\nvar y = 37;\n", |
+ "x/* precomment\n */ --> is eol-comment\nvar y = 37;\n", |
+ "var x = 42; --> is eol-comment\nvar y = 37;\n", |
+ "var x = 42; /* precomment\n */ --> is eol-comment\nvar y = 37;\n", |
+ NULL |
+ }; |
+ |
// Parser/Scanner needs a stack limit. |
int marker; |
i::Isolate::Current()->stack_guard()->SetStackLimit( |
@@ -163,6 +174,13 @@ |
CHECK(data != NULL && !data->HasError()); |
delete data; |
} |
+ |
+ for (int i = 0; fail_tests[i]; i++) { |
+ v8::ScriptData* data = |
+ v8::ScriptData::PreCompile(fail_tests[i], i::StrLength(fail_tests[i])); |
+ CHECK(data == NULL || data->HasError()); |
+ delete data; |
+ } |
} |