| 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/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 | 1179 |
| 1180 // Load up a test script in the test library. | 1180 // Load up a test script in the test library. |
| 1181 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 1181 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 1182 | 1182 |
| 1183 // Invoke a function which returns an object of type NativeFields. | 1183 // Invoke a function which returns an object of type NativeFields. |
| 1184 result = Dart_InvokeStatic(lib, | 1184 result = Dart_InvokeStatic(lib, |
| 1185 Dart_NewString("NativeFieldsTest"), | 1185 Dart_NewString("NativeFieldsTest"), |
| 1186 Dart_NewString("testMain"), | 1186 Dart_NewString("testMain"), |
| 1187 0, | 1187 0, |
| 1188 NULL); | 1188 NULL); |
| 1189 // We expect the test script to fail finalization with the error : | 1189 // We expect the test script to fail finalization with the error below: |
| 1190 // "class 'NativeFields' is trying to extend a native fields class," | |
| 1191 // "but library 'TestCase::url()' has no native resolvers". | |
| 1192 EXPECT(Dart_IsError(result)); | 1190 EXPECT(Dart_IsError(result)); |
| 1193 Dart_Handle expected_error = Dart_Error( | 1191 Dart_Handle expected_error = Dart_Error( |
| 1194 "class 'NativeFields' is trying to extend a native fields class," | 1192 "'dart:test-lib': Error: class 'NativeFields' is trying to extend a " |
| 1195 "but library '%s' has no native resolvers", TestCase::url()); | 1193 "native fields class, but library '%s' has no native resolvers", |
| 1194 TestCase::url()); |
| 1196 EXPECT_STREQ(Dart_GetError(expected_error), Dart_GetError(result)); | 1195 EXPECT_STREQ(Dart_GetError(expected_error), Dart_GetError(result)); |
| 1197 Dart_ExitScope(); // Exit the Dart API scope. | 1196 Dart_ExitScope(); // Exit the Dart API scope. |
| 1198 } | 1197 } |
| 1199 Dart_ShutdownIsolate(); | 1198 Dart_ShutdownIsolate(); |
| 1200 } | 1199 } |
| 1201 | 1200 |
| 1202 | 1201 |
| 1203 static void TestNativeFields(Dart_Handle retobj) { | 1202 static void TestNativeFields(Dart_Handle retobj) { |
| 1204 // Access and set various instance fields of the object. | 1203 // Access and set various instance fields of the object. |
| 1205 Dart_Handle result = Dart_GetInstanceField(retobj, Dart_NewString("fld3")); | 1204 Dart_Handle result = Dart_GetInstanceField(retobj, Dart_NewString("fld3")); |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 NULL); | 2277 NULL); |
| 2279 EXPECT_VALID(result); | 2278 EXPECT_VALID(result); |
| 2280 | 2279 |
| 2281 Dart_ExitScope(); // Exit the Dart API scope. | 2280 Dart_ExitScope(); // Exit the Dart API scope. |
| 2282 } | 2281 } |
| 2283 Dart_ShutdownIsolate(); | 2282 Dart_ShutdownIsolate(); |
| 2284 } | 2283 } |
| 2285 #endif // TARGET_ARCH_IA32. | 2284 #endif // TARGET_ARCH_IA32. |
| 2286 | 2285 |
| 2287 } // namespace dart | 2286 } // namespace dart |
| OLD | NEW |