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

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

Issue 8585004: Support correct factory syntax in the VM as decribed in the spec. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/parser.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assert.h" 5 #include "vm/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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 const Class& factory_class = Class::Handle(Class::New(class_name, script)); 161 const Class& factory_class = Class::Handle(Class::New(class_name, script));
162 const Array& no_fields = Array::Handle(Array::Empty()); 162 const Array& no_fields = Array::Handle(Array::Empty());
163 // Finalizes the class. 163 // Finalizes the class.
164 factory_class.SetFields(no_fields); 164 factory_class.SetFields(no_fields);
165 165
166 String& interface_name = String::Handle(String::NewSymbol("MyInterface")); 166 String& interface_name = String::Handle(String::NewSymbol("MyInterface"));
167 const Class& interface = 167 const Class& interface =
168 Class::Handle(Class::NewInterface(interface_name, script)); 168 Class::Handle(Class::NewInterface(interface_name, script));
169 EXPECT(interface.is_interface()); 169 EXPECT(interface.is_interface());
170 EXPECT(!factory_class.is_interface()); 170 EXPECT(!factory_class.is_interface());
171 EXPECT_EQ(Object::null(), interface.factory_type()); 171 EXPECT(!interface.HasFactoryClass());
172 const Type& factory_type = 172 interface.set_factory_class(factory_class);
173 Type::Handle(Type::NewNonParameterizedType(factory_class)); 173 EXPECT_EQ(factory_class.raw(), interface.FactoryClass());
174 interface.set_factory_type(factory_type);
175 EXPECT_EQ(factory_type.raw(), interface.factory_type());
176 } 174 }
177 175
178 176
179 TEST_CASE(Smi) { 177 TEST_CASE(Smi) {
180 const Smi& smi = Smi::Handle(Smi::New(5)); 178 const Smi& smi = Smi::Handle(Smi::New(5));
181 Object& smi_object = Object::Handle(smi.raw()); 179 Object& smi_object = Object::Handle(smi.raw());
182 EXPECT(smi.IsSmi()); 180 EXPECT(smi.IsSmi());
183 EXPECT(smi_object.IsSmi()); 181 EXPECT(smi_object.IsSmi());
184 EXPECT_EQ(5, smi.Value()); 182 EXPECT_EQ(5, smi.Value());
185 const Object& object = Object::Handle(); 183 const Object& object = Object::Handle();
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 cls = iterator.GetNextClass(); 1947 cls = iterator.GetNextClass();
1950 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); 1948 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw()));
1951 count++; 1949 count++;
1952 } 1950 }
1953 ASSERT(count == 2); 1951 ASSERT(count == 2);
1954 } 1952 }
1955 1953
1956 #endif // TARGET_ARCH_IA32. 1954 #endif // TARGET_ARCH_IA32.
1957 1955
1958 } // namespace dart 1956 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698