OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Tests v8::internal::Scanner. Note that presently most unit tests for the | 5 // Tests v8::internal::Scanner. Note that presently most unit tests for the |
6 // Scanner are in cctest/test-parsing.cc, rather than here. | 6 // Scanner are in cctest/test-parsing.cc, rather than here. |
7 | 7 |
8 #include "src/handles-inl.h" | 8 #include "src/handles-inl.h" |
| 9 #include "src/objects-inl.h" |
9 #include "src/parsing/scanner-character-streams.h" | 10 #include "src/parsing/scanner-character-streams.h" |
10 #include "src/parsing/scanner.h" | 11 #include "src/parsing/scanner.h" |
11 #include "src/unicode-cache.h" | 12 #include "src/unicode-cache.h" |
12 #include "test/cctest/cctest.h" | 13 #include "test/cctest/cctest.h" |
13 | 14 |
14 using namespace v8::internal; | 15 using namespace v8::internal; |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 const char src_simple[] = "function foo() { var x = 2 * a() + b; }"; | 19 const char src_simple[] = "function foo() { var x = 2 * a() + b; }"; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 }; | 98 }; |
98 | 99 |
99 for (const auto& test_case : test_cases) { | 100 for (const auto& test_case : test_cases) { |
100 auto scanner = make_scanner(test_case.src); | 101 auto scanner = make_scanner(test_case.src); |
101 for (size_t i = 0; test_case.tokens[i] != Token::EOS; i++) { | 102 for (size_t i = 0; test_case.tokens[i] != Token::EOS; i++) { |
102 DCHECK_TOK(test_case.tokens[i], scanner->Next()); | 103 DCHECK_TOK(test_case.tokens[i], scanner->Next()); |
103 } | 104 } |
104 DCHECK_TOK(Token::EOS, scanner->Next()); | 105 DCHECK_TOK(Token::EOS, scanner->Next()); |
105 } | 106 } |
106 } | 107 } |
OLD | NEW |