OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 | 167 |
168 TEST_CASE(TokenStream) { | 168 TEST_CASE(TokenStream) { |
169 String& source = String::Handle(String::New("= ( 9 , .")); | 169 String& source = String::Handle(String::New("= ( 9 , .")); |
170 String& private_key = String::Handle(String::New("")); | 170 String& private_key = String::Handle(String::New("")); |
171 Scanner scanner(source, private_key); | 171 Scanner scanner(source, private_key); |
172 const Scanner::GrowableTokenStream& ts = scanner.GetStream(); | 172 const Scanner::GrowableTokenStream& ts = scanner.GetStream(); |
173 EXPECT_EQ(6, ts.length()); | 173 EXPECT_EQ(6, ts.length()); |
174 EXPECT_EQ(Token::kLPAREN, ts[1].kind); | 174 EXPECT_EQ(Token::kLPAREN, ts[1].kind); |
175 const TokenStream& token_stream = TokenStream::Handle( | 175 const TokenStream& token_stream = TokenStream::Handle( |
176 TokenStream::New(ts, private_key)); | 176 TokenStream::New(ts, private_key, false)); |
177 TokenStream::Iterator iterator(token_stream, 0); | 177 TokenStream::Iterator iterator(token_stream, 0); |
178 // EXPECT_EQ(6, token_stream.Length()); | 178 // EXPECT_EQ(6, token_stream.Length()); |
179 iterator.Advance(); // Advance to '(' token. | 179 iterator.Advance(); // Advance to '(' token. |
180 EXPECT_EQ(Token::kLPAREN, iterator.CurrentTokenKind()); | 180 EXPECT_EQ(Token::kLPAREN, iterator.CurrentTokenKind()); |
181 iterator.Advance(); | 181 iterator.Advance(); |
182 iterator.Advance(); | 182 iterator.Advance(); |
183 iterator.Advance(); // Advance to '.' token. | 183 iterator.Advance(); // Advance to '.' token. |
184 EXPECT_EQ(Token::kPERIOD, iterator.CurrentTokenKind()); | 184 EXPECT_EQ(Token::kPERIOD, iterator.CurrentTokenKind()); |
185 iterator.Advance(); // Advance to end of stream. | 185 iterator.Advance(); // Advance to end of stream. |
186 EXPECT_EQ(Token::kEOS, iterator.CurrentTokenKind()); | 186 EXPECT_EQ(Token::kEOS, iterator.CurrentTokenKind()); |
(...skipping 4598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4785 String& test = String::Handle(); | 4785 String& test = String::Handle(); |
4786 String& result = String::Handle(); | 4786 String& result = String::Handle(); |
4787 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { | 4787 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { |
4788 test = String::New(tests[i].in); | 4788 test = String::New(tests[i].in); |
4789 result = String::IdentifierPrettyName(test); | 4789 result = String::IdentifierPrettyName(test); |
4790 EXPECT_STREQ(tests[i].out, result.ToCString()); | 4790 EXPECT_STREQ(tests[i].out, result.ToCString()); |
4791 } | 4791 } |
4792 } | 4792 } |
4793 | 4793 |
4794 } // namespace dart | 4794 } // namespace dart |
OLD | NEW |