| Index: test/cctest/test-parsing.cc
|
| ===================================================================
|
| --- test/cctest/test-parsing.cc (revision 8618)
|
| +++ 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;
|
| + }
|
| }
|
|
|
|
|
| @@ -253,7 +271,7 @@
|
| "{label: 42}",
|
| "var x = 42;",
|
| "function foo(x, y) { return x + y; }",
|
| - "native function foo(); return %ArgleBargle(glop);",
|
| + "%ArgleBargle(glop);",
|
| "var x = new new Function('this.x = 42');",
|
| NULL
|
| };
|
| @@ -265,7 +283,7 @@
|
| reinterpret_cast<const i::byte*>(program),
|
| static_cast<unsigned>(strlen(program)));
|
| i::CompleteParserRecorder log;
|
| - i::V8JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
|
| + i::JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
|
| scanner.Initialize(&stream);
|
|
|
| v8::preparser::PreParser::PreParseResult result =
|
| @@ -358,7 +376,7 @@
|
| reinterpret_cast<const i::byte*>(*program),
|
| static_cast<unsigned>(kProgramSize));
|
| i::CompleteParserRecorder log;
|
| - i::V8JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
|
| + i::JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
|
| scanner.Initialize(&stream);
|
|
|
|
|
| @@ -576,7 +594,7 @@
|
| i::Token::Value* expected_tokens,
|
| int skip_pos = 0, // Zero means not skipping.
|
| int skip_to = 0) {
|
| - i::V8JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
|
| + i::JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
|
| scanner.Initialize(stream);
|
|
|
| int i = 0;
|
| @@ -655,7 +673,7 @@
|
| i::Utf8ToUC16CharacterStream stream(
|
| reinterpret_cast<const i::byte*>(re_source),
|
| static_cast<unsigned>(strlen(re_source)));
|
| - i::V8JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
|
| + i::JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
|
| scanner.Initialize(&stream);
|
|
|
| i::Token::Value start = scanner.peek();
|
|
|