Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: runtime/vm/object_test.cc

Issue 1420103006: Shared token objects (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: catch up Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object_store.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/object_store.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698