| 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" |
| 11 #include "vm/debugger.h" | 11 #include "vm/debugger.h" |
| 12 #include "vm/isolate.h" | 12 #include "vm/isolate.h" |
| 13 #include "vm/object.h" | 13 #include "vm/object.h" |
| 14 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 15 #include "vm/simulator.h" | 15 #include "vm/simulator.h" |
| 16 #include "vm/symbols.h" | 16 #include "vm/symbols.h" |
| 17 #include "vm/unit_test.h" | 17 #include "vm/unit_test.h" |
| 18 #include "vm/code_descriptors.h" | 18 #include "vm/code_descriptors.h" |
| 19 | 19 |
| 20 namespace dart { | 20 namespace dart { |
| 21 | 21 |
| 22 DECLARE_FLAG(bool, write_protect_code); | 22 DECLARE_FLAG(bool, write_protect_code); |
| 23 | 23 |
| 24 | 24 |
| 25 static RawClass* CreateDummyClass(const String& class_name, | 25 static RawClass* CreateDummyClass(const String& class_name, |
| 26 const Script& script) { | 26 const Script& script) { |
| 27 const Class& cls = Class::Handle( | 27 const Class& cls = Class::Handle(Class::New( |
| 28 Class::New(class_name, script, TokenPosition::kNoSource)); | 28 Library::Handle(), class_name, script, TokenPosition::kNoSource)); |
| 29 cls.set_is_synthesized_class(); // Dummy class for testing. | 29 cls.set_is_synthesized_class(); // Dummy class for testing. |
| 30 return cls.raw(); | 30 return cls.raw(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 | 33 |
| 34 VM_TEST_CASE(Class) { | 34 VM_TEST_CASE(Class) { |
| 35 // Allocate the class first. | 35 // Allocate the class first. |
| 36 const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); | 36 const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); |
| 37 const Script& script = Script::Handle(); | 37 const Script& script = Script::Handle(); |
| 38 const Class& cls = Class::Handle(CreateDummyClass(class_name, script)); | 38 const Class& cls = Class::Handle(CreateDummyClass(class_name, script)); |
| (...skipping 4681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4720 String& test = String::Handle(); | 4720 String& test = String::Handle(); |
| 4721 String& result = String::Handle(); | 4721 String& result = String::Handle(); |
| 4722 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { | 4722 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { |
| 4723 test = String::New(tests[i].in); | 4723 test = String::New(tests[i].in); |
| 4724 result = String::ScrubName(test); | 4724 result = String::ScrubName(test); |
| 4725 EXPECT_STREQ(tests[i].out, result.ToCString()); | 4725 EXPECT_STREQ(tests[i].out, result.ToCString()); |
| 4726 } | 4726 } |
| 4727 } | 4727 } |
| 4728 | 4728 |
| 4729 } // namespace dart | 4729 } // namespace dart |
| OLD | NEW |