| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "platform/utils.h" | 7 #include "platform/utils.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_api_state.h" | 10 #include "vm/dart_api_state.h" |
| (...skipping 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2302 TestFieldOk(lib, name, false, "hidden top getset"); | 2302 TestFieldOk(lib, name, false, "hidden top getset"); |
| 2303 } | 2303 } |
| 2304 | 2304 |
| 2305 | 2305 |
| 2306 TEST_CASE(SetField_FunnyValue) { | 2306 TEST_CASE(SetField_FunnyValue) { |
| 2307 const char* kScriptChars = | 2307 const char* kScriptChars = |
| 2308 "var top;\n"; | 2308 "var top;\n"; |
| 2309 | 2309 |
| 2310 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 2310 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 2311 Dart_Handle name = Dart_NewString("top"); | 2311 Dart_Handle name = Dart_NewString("top"); |
| 2312 | |
| 2313 Dart_Handle args[1]; | |
| 2314 bool value; | 2312 bool value; |
| 2315 | 2313 |
| 2316 // Test that you can set the field to a good value. | 2314 // Test that you can set the field to a good value. |
| 2317 EXPECT_VALID(Dart_SetField(lib, name, Dart_True())); | 2315 EXPECT_VALID(Dart_SetField(lib, name, Dart_True())); |
| 2318 Dart_Handle result = Dart_GetField(lib, name); | 2316 Dart_Handle result = Dart_GetField(lib, name); |
| 2319 EXPECT_VALID(result); | 2317 EXPECT_VALID(result); |
| 2320 EXPECT(Dart_IsBoolean(result)); | 2318 EXPECT(Dart_IsBoolean(result)); |
| 2321 EXPECT_VALID(Dart_BooleanValue(result, &value)); | 2319 EXPECT_VALID(Dart_BooleanValue(result, &value)); |
| 2322 EXPECT(value); | 2320 EXPECT(value); |
| 2323 | 2321 |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3097 result = Dart_StringToCString(result, &str); | 3095 result = Dart_StringToCString(result, &str); |
| 3098 EXPECT_STREQ("hidden top !!!", str); | 3096 EXPECT_STREQ("hidden top !!!", str); |
| 3099 } | 3097 } |
| 3100 | 3098 |
| 3101 | 3099 |
| 3102 TEST_CASE(Invoke_FunnyArgs) { | 3100 TEST_CASE(Invoke_FunnyArgs) { |
| 3103 const char* kScriptChars = | 3101 const char* kScriptChars = |
| 3104 "test(arg) => 'hello $arg';\n"; | 3102 "test(arg) => 'hello $arg';\n"; |
| 3105 | 3103 |
| 3106 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 3104 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 3107 Dart_Handle name = Dart_NewString("test"); | |
| 3108 | |
| 3109 Dart_Handle args[1]; | 3105 Dart_Handle args[1]; |
| 3110 const char* str; | 3106 const char* str; |
| 3111 | 3107 |
| 3112 // Make sure that valid args yield valid results. | 3108 // Make sure that valid args yield valid results. |
| 3113 args[0] = Dart_NewString("!!!"); | 3109 args[0] = Dart_NewString("!!!"); |
| 3114 Dart_Handle result = Dart_Invoke(lib, Dart_NewString("test"), 1, args); | 3110 Dart_Handle result = Dart_Invoke(lib, Dart_NewString("test"), 1, args); |
| 3115 EXPECT_VALID(result); | 3111 EXPECT_VALID(result); |
| 3116 result = Dart_StringToCString(result, &str); | 3112 result = Dart_StringToCString(result, &str); |
| 3117 EXPECT_STREQ("hello !!!", str); | 3113 EXPECT_STREQ("hello !!!", str); |
| 3118 | 3114 |
| (...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4682 // We should have received the expected number of interrupts. | 4678 // We should have received the expected number of interrupts. |
| 4683 EXPECT_EQ(kInterruptCount, interrupt_count); | 4679 EXPECT_EQ(kInterruptCount, interrupt_count); |
| 4684 | 4680 |
| 4685 // Give the spawned thread enough time to properly exit. | 4681 // Give the spawned thread enough time to properly exit. |
| 4686 Isolate::SetInterruptCallback(saved); | 4682 Isolate::SetInterruptCallback(saved); |
| 4687 } | 4683 } |
| 4688 | 4684 |
| 4689 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 4685 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 4690 | 4686 |
| 4691 } // namespace dart | 4687 } // namespace dart |
| OLD | NEW |