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

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

Issue 1969563002: Eliminate GrowableTokenStream (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months 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.cc ('k') | runtime/vm/scanner.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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 type_arguments1.Canonicalize(); 158 type_arguments1.Canonicalize();
159 type_arguments3 ^= type_arguments2.Canonicalize(); 159 type_arguments3 ^= type_arguments2.Canonicalize();
160 EXPECT_EQ(type_arguments1.raw(), type_arguments3.raw()); 160 EXPECT_EQ(type_arguments1.raw(), type_arguments3.raw());
161 } 161 }
162 162
163 163
164 VM_TEST_CASE(TokenStream) { 164 VM_TEST_CASE(TokenStream) {
165 Zone* zone = Thread::Current()->zone(); 165 Zone* zone = Thread::Current()->zone();
166 String& source = String::Handle(zone, String::New("= ( 9 , .")); 166 String& source = String::Handle(zone, String::New("= ( 9 , ."));
167 String& private_key = String::Handle(zone, String::New("")); 167 String& private_key = String::Handle(zone, String::New(""));
168 Scanner scanner(source, private_key);
169 const Scanner::GrowableTokenStream& ts = scanner.GetStream();
170 EXPECT_EQ(6, ts.length());
171 EXPECT_EQ(Token::kLPAREN, ts[1].kind);
172 const TokenStream& token_stream = TokenStream::Handle( 168 const TokenStream& token_stream = TokenStream::Handle(
173 zone, TokenStream::New(ts, private_key, false)); 169 zone, TokenStream::New(source, private_key, false));
174 TokenStream::Iterator iterator(zone, token_stream, TokenPosition::kMinSource); 170 TokenStream::Iterator iterator(zone, token_stream, TokenPosition::kMinSource);
175 // EXPECT_EQ(6, token_stream.Length());
176 iterator.Advance(); // Advance to '(' token. 171 iterator.Advance(); // Advance to '(' token.
177 EXPECT_EQ(Token::kLPAREN, iterator.CurrentTokenKind()); 172 EXPECT_EQ(Token::kLPAREN, iterator.CurrentTokenKind());
178 iterator.Advance(); 173 iterator.Advance();
179 iterator.Advance(); 174 iterator.Advance();
180 iterator.Advance(); // Advance to '.' token. 175 iterator.Advance(); // Advance to '.' token.
181 EXPECT_EQ(Token::kPERIOD, iterator.CurrentTokenKind()); 176 EXPECT_EQ(Token::kPERIOD, iterator.CurrentTokenKind());
182 iterator.Advance(); // Advance to end of stream. 177 iterator.Advance(); // Advance to end of stream.
183 EXPECT_EQ(Token::kEOS, iterator.CurrentTokenKind()); 178 EXPECT_EQ(Token::kEOS, iterator.CurrentTokenKind());
184 } 179 }
185 180
(...skipping 4539 matching lines...) Expand 10 before | Expand all | Expand 10 after
4725 String& test = String::Handle(); 4720 String& test = String::Handle();
4726 String& result = String::Handle(); 4721 String& result = String::Handle();
4727 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { 4722 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) {
4728 test = String::New(tests[i].in); 4723 test = String::New(tests[i].in);
4729 result = String::ScrubName(test); 4724 result = String::ScrubName(test);
4730 EXPECT_STREQ(tests[i].out, result.ToCString()); 4725 EXPECT_STREQ(tests[i].out, result.ToCString());
4731 } 4726 }
4732 } 4727 }
4733 4728
4734 } // namespace dart 4729 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698