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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 OS::Print("2: %s\n", type_arguments2.ToCString()); | 155 OS::Print("2: %s\n", type_arguments2.ToCString()); |
156 EXPECT(type_arguments1.Equals(type_arguments2)); | 156 EXPECT(type_arguments1.Equals(type_arguments2)); |
157 TypeArguments& type_arguments3 = TypeArguments::Handle(); | 157 TypeArguments& type_arguments3 = TypeArguments::Handle(); |
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 String& source = String::Handle(String::New("= ( 9 , .")); | 165 Zone* zone = Thread::Current()->zone(); |
166 String& private_key = String::Handle(String::New("")); | 166 String& source = String::Handle(zone, String::New("= ( 9 , .")); |
| 167 String& private_key = String::Handle(zone, String::New("")); |
167 Scanner scanner(source, private_key); | 168 Scanner scanner(source, private_key); |
168 const Scanner::GrowableTokenStream& ts = scanner.GetStream(); | 169 const Scanner::GrowableTokenStream& ts = scanner.GetStream(); |
169 EXPECT_EQ(6, ts.length()); | 170 EXPECT_EQ(6, ts.length()); |
170 EXPECT_EQ(Token::kLPAREN, ts[1].kind); | 171 EXPECT_EQ(Token::kLPAREN, ts[1].kind); |
171 const TokenStream& token_stream = TokenStream::Handle( | 172 const TokenStream& token_stream = TokenStream::Handle( |
172 TokenStream::New(ts, private_key, false)); | 173 zone, TokenStream::New(ts, private_key, false)); |
173 TokenStream::Iterator iterator(token_stream, TokenPosition::kMinSource); | 174 TokenStream::Iterator iterator(zone, token_stream, TokenPosition::kMinSource); |
174 // EXPECT_EQ(6, token_stream.Length()); | 175 // EXPECT_EQ(6, token_stream.Length()); |
175 iterator.Advance(); // Advance to '(' token. | 176 iterator.Advance(); // Advance to '(' token. |
176 EXPECT_EQ(Token::kLPAREN, iterator.CurrentTokenKind()); | 177 EXPECT_EQ(Token::kLPAREN, iterator.CurrentTokenKind()); |
177 iterator.Advance(); | 178 iterator.Advance(); |
178 iterator.Advance(); | 179 iterator.Advance(); |
179 iterator.Advance(); // Advance to '.' token. | 180 iterator.Advance(); // Advance to '.' token. |
180 EXPECT_EQ(Token::kPERIOD, iterator.CurrentTokenKind()); | 181 EXPECT_EQ(Token::kPERIOD, iterator.CurrentTokenKind()); |
181 iterator.Advance(); // Advance to end of stream. | 182 iterator.Advance(); // Advance to end of stream. |
182 EXPECT_EQ(Token::kEOS, iterator.CurrentTokenKind()); | 183 EXPECT_EQ(Token::kEOS, iterator.CurrentTokenKind()); |
183 } | 184 } |
(...skipping 4542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4726 String& test = String::Handle(); | 4727 String& test = String::Handle(); |
4727 String& result = String::Handle(); | 4728 String& result = String::Handle(); |
4728 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { | 4729 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { |
4729 test = String::New(tests[i].in); | 4730 test = String::New(tests[i].in); |
4730 result = String::ScrubName(test); | 4731 result = String::ScrubName(test); |
4731 EXPECT_STREQ(tests[i].out, result.ToCString()); | 4732 EXPECT_STREQ(tests[i].out, result.ToCString()); |
4732 } | 4733 } |
4733 } | 4734 } |
4734 | 4735 |
4735 } // namespace dart | 4736 } // namespace dart |
OLD | NEW |