| 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 6902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6913 } | 6913 } |
| 6914 | 6914 |
| 6915 | 6915 |
| 6916 // Test API call to make strings external. | 6916 // Test API call to make strings external. |
| 6917 static void MakeExternalCback(void* peer) { | 6917 static void MakeExternalCback(void* peer) { |
| 6918 *static_cast<int*>(peer) *= 2; | 6918 *static_cast<int*>(peer) *= 2; |
| 6919 } | 6919 } |
| 6920 | 6920 |
| 6921 | 6921 |
| 6922 TEST_CASE(MakeExternalString) { | 6922 TEST_CASE(MakeExternalString) { |
| 6923 int peer8 = 40; | 6923 static int peer8 = 40; |
| 6924 int peer16 = 41; | 6924 static int peer16 = 41; |
| 6925 int canonical_str_peer = 42; | 6925 static int canonical_str_peer = 42; |
| 6926 intptr_t length = 0; | 6926 intptr_t length = 0; |
| 6927 intptr_t expected_length = 0; | 6927 intptr_t expected_length = 0; |
| 6928 { | 6928 { |
| 6929 Dart_EnterScope(); | 6929 Dart_EnterScope(); |
| 6930 | 6930 |
| 6931 // First test some negative conditions. | 6931 // First test some negative conditions. |
| 6932 uint8_t data8[] = { 'h', 'e', 'l', 'l', 'o' }; | 6932 uint8_t data8[] = { 'h', 'e', 'l', 'l', 'o' }; |
| 6933 const char* err = "string"; | 6933 const char* err = "string"; |
| 6934 Dart_Handle err_str = NewString(err); | 6934 Dart_Handle err_str = NewString(err); |
| 6935 Dart_Handle ext_err_str = Dart_NewExternalLatin1String( | 6935 Dart_Handle ext_err_str = Dart_NewExternalLatin1String( |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7317 NewString("main"), | 7317 NewString("main"), |
| 7318 0, | 7318 0, |
| 7319 NULL); | 7319 NULL); |
| 7320 int64_t value = 0; | 7320 int64_t value = 0; |
| 7321 result = Dart_IntegerToInt64(result, &value); | 7321 result = Dart_IntegerToInt64(result, &value); |
| 7322 EXPECT_VALID(result); | 7322 EXPECT_VALID(result); |
| 7323 EXPECT_EQ(8, value); | 7323 EXPECT_EQ(8, value); |
| 7324 } | 7324 } |
| 7325 | 7325 |
| 7326 } // namespace dart | 7326 } // namespace dart |
| OLD | NEW |