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/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 | 136 |
137 TEST_CASE(TokenStream) { | 137 TEST_CASE(TokenStream) { |
138 String& source = String::Handle(String::New("= ( 9 , .")); | 138 String& source = String::Handle(String::New("= ( 9 , .")); |
139 String& private_key = String::Handle(String::New("")); | 139 String& private_key = String::Handle(String::New("")); |
140 Scanner scanner(source, private_key); | 140 Scanner scanner(source, private_key); |
141 const Scanner::GrowableTokenStream& ts = scanner.GetStream(); | 141 const Scanner::GrowableTokenStream& ts = scanner.GetStream(); |
142 EXPECT_EQ(6, ts.length()); | 142 EXPECT_EQ(6, ts.length()); |
143 EXPECT_EQ(Token::kLPAREN, ts[1].kind); | 143 EXPECT_EQ(Token::kLPAREN, ts[1].kind); |
144 const TokenStream& token_stream = TokenStream::Handle(TokenStream::New(ts)); | 144 const TokenStream& token_stream = TokenStream::Handle(TokenStream::New(ts)); |
145 EXPECT_EQ(6, token_stream.Length()); | 145 TokenStream::Iterator iterator(token_stream, 0); |
146 EXPECT_EQ(Token::kLPAREN, token_stream.KindAt(1)); | 146 // EXPECT_EQ(6, token_stream.Length()); |
147 EXPECT_EQ(Token::kPERIOD, token_stream.KindAt(4)); | 147 iterator.Advance(); // Advance to '(' token. |
148 EXPECT_EQ(Token::kEOS, token_stream.KindAt(5)); | 148 EXPECT_EQ(Token::kLPAREN, iterator.CurrentTokenKind()); |
| 149 iterator.Advance(); |
| 150 iterator.Advance(); |
| 151 iterator.Advance(); // Advance to '.' token. |
| 152 EXPECT_EQ(Token::kPERIOD, iterator.CurrentTokenKind()); |
| 153 iterator.Advance(); // Advance to end of stream. |
| 154 EXPECT_EQ(Token::kEOS, iterator.CurrentTokenKind()); |
149 } | 155 } |
150 | 156 |
151 | 157 |
152 TEST_CASE(InstanceClass) { | 158 TEST_CASE(InstanceClass) { |
153 // Allocate the class first. | 159 // Allocate the class first. |
154 String& class_name = String::Handle(String::NewSymbol("EmptyClass")); | 160 String& class_name = String::Handle(String::NewSymbol("EmptyClass")); |
155 Script& script = Script::Handle(); | 161 Script& script = Script::Handle(); |
156 const Class& empty_class = | 162 const Class& empty_class = |
157 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); | 163 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); |
158 | 164 |
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 // Named double-private constructor mismatch. | 2777 // Named double-private constructor mismatch. |
2772 mangled_name = String::New("foo@12345.named@12345"); | 2778 mangled_name = String::New("foo@12345.named@12345"); |
2773 bare_name = String::New("foo.name"); | 2779 bare_name = String::New("foo.name"); |
2774 EXPECT(!EqualsIgnoringPrivate(mangled_name, bare_name)); | 2780 EXPECT(!EqualsIgnoringPrivate(mangled_name, bare_name)); |
2775 } | 2781 } |
2776 | 2782 |
2777 | 2783 |
2778 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 2784 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
2779 | 2785 |
2780 } // namespace dart | 2786 } // namespace dart |
OLD | NEW |