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