| OLD | NEW |
| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
| 10 #include "vm/thread.h" | 10 #include "vm/thread.h" |
| 11 #include "vm/unit_test.h" | 11 #include "vm/unit_test.h" |
| 12 #include "vm/utils.h" | 12 #include "vm/utils.h" |
| 13 #include "vm/verifier.h" | 13 #include "vm/verifier.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests. | 17 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests. |
| 18 | 18 |
| 19 TEST_CASE(ErrorHandles) { | 19 TEST_CASE(ErrorHandles) { |
| 20 const char* kScriptChars = | 20 const char* kScriptChars = |
| 21 "class TestClass {\n" | 21 "class TestClass {\n" |
| 22 " static void testMain() {\n" | 22 " static void testMain() {\n" |
| 23 " throw new Exception(\"bad news\");\n" | 23 " throw new Exception(\"bad news\");\n" |
| 24 " }\n" | 24 " }\n" |
| 25 "}\n"; | 25 "}\n"; |
| 26 | 26 |
| 27 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 27 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 28 | 28 |
| 29 Dart_Handle instance = Dart_True(); | 29 Dart_Handle instance = Dart_True(); |
| 30 Dart_Handle error = Api::Error("myerror"); | 30 Dart_Handle error = Api::NewError("myerror"); |
| 31 Dart_Handle exception = Dart_InvokeStatic(lib, | 31 Dart_Handle exception = Dart_InvokeStatic(lib, |
| 32 Dart_NewString("TestClass"), | 32 Dart_NewString("TestClass"), |
| 33 Dart_NewString("testMain"), | 33 Dart_NewString("testMain"), |
| 34 0, | 34 0, |
| 35 NULL); | 35 NULL); |
| 36 | 36 |
| 37 EXPECT(!Dart_IsError(instance)); | 37 EXPECT(!Dart_IsError(instance)); |
| 38 EXPECT(Dart_IsError(error)); | 38 EXPECT(Dart_IsError(error)); |
| 39 EXPECT(Dart_IsError(exception)); | 39 EXPECT(Dart_IsError(exception)); |
| 40 | 40 |
| (...skipping 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2971 // We should have received the expected number of interrupts. | 2971 // We should have received the expected number of interrupts. |
| 2972 EXPECT_EQ(kInterruptCount, interrupt_count); | 2972 EXPECT_EQ(kInterruptCount, interrupt_count); |
| 2973 | 2973 |
| 2974 // Give the spawned thread enough time to properly exit. | 2974 // Give the spawned thread enough time to properly exit. |
| 2975 Isolate::SetInterruptCallback(saved); | 2975 Isolate::SetInterruptCallback(saved); |
| 2976 } | 2976 } |
| 2977 | 2977 |
| 2978 #endif // TARGET_ARCH_IA32. | 2978 #endif // TARGET_ARCH_IA32. |
| 2979 | 2979 |
| 2980 } // namespace dart | 2980 } // namespace dart |
| OLD | NEW |