OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 i::Token::Value expected = expected_tokens[i]; | 626 i::Token::Value expected = expected_tokens[i]; |
627 i::Token::Value actual = scanner.Next(); | 627 i::Token::Value actual = scanner.Next(); |
628 CHECK_EQ(i::Token::String(expected), i::Token::String(actual)); | 628 CHECK_EQ(i::Token::String(expected), i::Token::String(actual)); |
629 if (scanner.location().end_pos == skip_pos) { | 629 if (scanner.location().end_pos == skip_pos) { |
630 scanner.SeekForward(skip_to); | 630 scanner.SeekForward(skip_to); |
631 } | 631 } |
632 i++; | 632 i++; |
633 } while (expected_tokens[i] != i::Token::ILLEGAL); | 633 } while (expected_tokens[i] != i::Token::ILLEGAL); |
634 } | 634 } |
635 | 635 |
| 636 |
636 TEST(StreamScanner) { | 637 TEST(StreamScanner) { |
637 v8::V8::Initialize(); | 638 v8::V8::Initialize(); |
638 | 639 |
639 const char* str1 = "{ foo get for : */ <- \n\n /*foo*/ bib"; | 640 const char* str1 = "{ foo get for : */ <- \n\n /*foo*/ bib"; |
640 i::Utf8ToUtf16CharacterStream stream1(reinterpret_cast<const i::byte*>(str1), | 641 i::Utf8ToUtf16CharacterStream stream1(reinterpret_cast<const i::byte*>(str1), |
641 static_cast<unsigned>(strlen(str1))); | 642 static_cast<unsigned>(strlen(str1))); |
642 i::Token::Value expectations1[] = { | 643 i::Token::Value expectations1[] = { |
643 i::Token::LBRACE, | 644 i::Token::LBRACE, |
644 i::Token::IDENTIFIER, | 645 i::Token::IDENTIFIER, |
645 i::Token::IDENTIFIER, | 646 i::Token::IDENTIFIER, |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 " b = function() { \n" | 1312 " b = function() { \n" |
1312 " 01; \n" | 1313 " 01; \n" |
1313 " }; \n" | 1314 " }; \n" |
1314 "}; \n"; | 1315 "}; \n"; |
1315 v8::Script::Compile(v8::String::New(script)); | 1316 v8::Script::Compile(v8::String::New(script)); |
1316 CHECK(try_catch.HasCaught()); | 1317 CHECK(try_catch.HasCaught()); |
1317 v8::String::Utf8Value exception(try_catch.Exception()); | 1318 v8::String::Utf8Value exception(try_catch.Exception()); |
1318 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", | 1319 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", |
1319 *exception); | 1320 *exception); |
1320 } | 1321 } |
OLD | NEW |