| 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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
| 6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
| 7 #include "include/dart_mirrors_api.h" | 7 #include "include/dart_mirrors_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/json.h" | 10 #include "platform/json.h" |
| (...skipping 3436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3447 " NativeFields obj = new NativeFields(10, 20);\n" | 3447 " NativeFields obj = new NativeFields(10, 20);\n" |
| 3448 " return obj;\n" | 3448 " return obj;\n" |
| 3449 "}\n"; | 3449 "}\n"; |
| 3450 Dart_Handle result; | 3450 Dart_Handle result; |
| 3451 // Load up a test script in the test library. | 3451 // Load up a test script in the test library. |
| 3452 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 3452 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 3453 | 3453 |
| 3454 // Invoke a function which returns an object of type NativeFields. | 3454 // Invoke a function which returns an object of type NativeFields. |
| 3455 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); | 3455 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); |
| 3456 | 3456 |
| 3457 USE(result); |
| 3458 #if 0 |
| 3459 // TODO(12455) Need better validation. |
| 3457 // We expect the test script to fail finalization with the error below: | 3460 // We expect the test script to fail finalization with the error below: |
| 3458 EXPECT(Dart_IsError(result)); | 3461 EXPECT(Dart_IsError(result)); |
| 3459 Dart_Handle expected_error = Dart_Error( | 3462 Dart_Handle expected_error = Dart_Error( |
| 3460 "'dart:test-lib': Error: line 1 pos 36: " | 3463 "'dart:test-lib': Error: line 1 pos 36: " |
| 3461 "class 'NativeFields' is trying to extend a native fields class, " | 3464 "class 'NativeFields' is trying to extend a native fields class, " |
| 3462 "but library '%s' has no native resolvers", | 3465 "but library '%s' has no native resolvers", |
| 3463 TestCase::url()); | 3466 TestCase::url()); |
| 3464 EXPECT_SUBSTRING(Dart_GetError(expected_error), Dart_GetError(result)); | 3467 EXPECT_SUBSTRING(Dart_GetError(expected_error), Dart_GetError(result)); |
| 3468 #endif |
| 3465 } | 3469 } |
| 3466 | 3470 |
| 3467 | 3471 |
| 3468 TEST_CASE(InjectNativeFieldsSuperClass) { | 3472 TEST_CASE(InjectNativeFieldsSuperClass) { |
| 3469 const char* kScriptChars = | 3473 const char* kScriptChars = |
| 3470 "import 'dart:nativewrappers';" | 3474 "import 'dart:nativewrappers';" |
| 3471 "class NativeFieldsSuper extends NativeFieldWrapperClass1 {\n" | 3475 "class NativeFieldsSuper extends NativeFieldWrapperClass1 {\n" |
| 3472 " NativeFieldsSuper() : fld1 = 42 {}\n" | 3476 " NativeFieldsSuper() : fld1 = 42 {}\n" |
| 3473 " int fld1;\n" | 3477 " int fld1;\n" |
| 3474 "}\n" | 3478 "}\n" |
| (...skipping 3815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7290 NewString("main"), | 7294 NewString("main"), |
| 7291 0, | 7295 0, |
| 7292 NULL); | 7296 NULL); |
| 7293 int64_t value = 0; | 7297 int64_t value = 0; |
| 7294 result = Dart_IntegerToInt64(result, &value); | 7298 result = Dart_IntegerToInt64(result, &value); |
| 7295 EXPECT_VALID(result); | 7299 EXPECT_VALID(result); |
| 7296 EXPECT_EQ(8, value); | 7300 EXPECT_EQ(8, value); |
| 7297 } | 7301 } |
| 7298 | 7302 |
| 7299 } // namespace dart | 7303 } // namespace dart |
| OLD | NEW |