| 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/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/resolver.h" | 11 #include "vm/resolver.h" |
| 12 #include "vm/symbols.h" | 12 #include "vm/symbols.h" |
| 13 #include "vm/unit_test.h" | 13 #include "vm/unit_test.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 // Only IA32, X64, and ARM can run execution tests. | |
| 18 #if defined(TARGET_ARCH_IA32) || \ | |
| 19 defined(TARGET_ARCH_X64) || \ | |
| 20 defined(TARGET_ARCH_ARM) | |
| 21 | |
| 22 TEST_CASE(DartEntry) { | 17 TEST_CASE(DartEntry) { |
| 23 const char* kScriptChars = | 18 const char* kScriptChars = |
| 24 "class A {\n" | 19 "class A {\n" |
| 25 " static foo() { return 42; }\n" | 20 " static foo() { return 42; }\n" |
| 26 "}\n"; | 21 "}\n"; |
| 27 String& url = String::Handle(String::New("dart-test:DartEntry")); | 22 String& url = String::Handle(String::New("dart-test:DartEntry")); |
| 28 String& source = String::Handle(String::New(kScriptChars)); | 23 String& source = String::Handle(String::New(kScriptChars)); |
| 29 Script& script = Script::Handle(Script::New(url, | 24 Script& script = Script::Handle(Script::New(url, |
| 30 source, | 25 source, |
| 31 RawScript::kScriptTag)); | 26 RawScript::kScriptTag)); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 Function& function = Function::Handle(cls.LookupDynamicFunction(name)); | 103 Function& function = Function::Handle(cls.LookupDynamicFunction(name)); |
| 109 EXPECT(!function.IsNull()); | 104 EXPECT(!function.IsNull()); |
| 110 const Array& args = Array::Handle(Array::New(1)); | 105 const Array& args = Array::Handle(Array::New(1)); |
| 111 args.SetAt(0, instance); | 106 args.SetAt(0, instance); |
| 112 const Object& retval = Object::Handle(DartEntry::InvokeFunction(function, | 107 const Object& retval = Object::Handle(DartEntry::InvokeFunction(function, |
| 113 args)); | 108 args)); |
| 114 EXPECT(retval.IsError()); | 109 EXPECT(retval.IsError()); |
| 115 EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString()); | 110 EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString()); |
| 116 } | 111 } |
| 117 | 112 |
| 118 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 || TARGET_ARCH_ARM | |
| 119 | |
| 120 } // namespace dart | 113 } // namespace dart |
| OLD | NEW |