Index: runtime/vm/dart_api_impl_test.cc |
=================================================================== |
--- runtime/vm/dart_api_impl_test.cc (revision 26045) |
+++ runtime/vm/dart_api_impl_test.cc (working copy) |
@@ -542,6 +542,16 @@ |
intptr_t len = -1; |
EXPECT_VALID(Dart_StringLength(latin1str, &len)); |
EXPECT_EQ(4, len); |
+ intptr_t char_size; |
+ intptr_t str_len; |
+ void* peer; |
+ EXPECT_VALID(Dart_StringGetProperties(latin1str, |
+ &char_size, |
+ &str_len, |
+ &peer)); |
+ EXPECT_EQ(1, char_size); |
+ EXPECT_EQ(4, str_len); |
+ EXPECT(!peer); |
uint8_t data8[] = { 'o', 'n', 'e', 0x7F }; |
@@ -562,10 +572,17 @@ |
} |
Dart_Handle ext8 = Dart_NewExternalLatin1String(data8, ARRAY_SIZE(data8), |
- NULL, NULL); |
+ data8, NULL); |
EXPECT_VALID(ext8); |
EXPECT(Dart_IsString(ext8)); |
EXPECT(Dart_IsExternalString(ext8)); |
+ EXPECT_VALID(Dart_StringGetProperties(ext8, |
+ &char_size, |
+ &str_len, |
+ &peer)); |
+ EXPECT_EQ(1, char_size); |
+ EXPECT_EQ(4, str_len); |
+ EXPECT_EQ(data8, peer); |
uint16_t data16[] = { 't', 'w', 'o', 0xFFFF }; |
@@ -574,12 +591,26 @@ |
EXPECT(Dart_IsString(str16)); |
EXPECT(!Dart_IsStringLatin1(str16)); |
EXPECT(!Dart_IsExternalString(str16)); |
+ EXPECT_VALID(Dart_StringGetProperties(str16, |
+ &char_size, |
+ &str_len, |
+ &peer)); |
+ EXPECT_EQ(2, char_size); |
+ EXPECT_EQ(4, str_len); |
+ EXPECT(!peer); |
Dart_Handle ext16 = Dart_NewExternalUTF16String(data16, ARRAY_SIZE(data16), |
- NULL, NULL); |
+ data16, NULL); |
EXPECT_VALID(ext16); |
EXPECT(Dart_IsString(ext16)); |
EXPECT(Dart_IsExternalString(ext16)); |
+ EXPECT_VALID(Dart_StringGetProperties(ext16, |
+ &char_size, |
+ &str_len, |
+ &peer)); |
+ EXPECT_EQ(2, char_size); |
+ EXPECT_EQ(4, str_len); |
+ EXPECT_EQ(data16, peer); |
int32_t data32[] = { 'f', 'o', 'u', 'r', 0x10FFFF }; |
@@ -7105,8 +7136,15 @@ |
Dart_EnterScope(); |
Dart_Handle str = Dart_GetNativeArgument(args, 0); |
EXPECT(Dart_IsString(str)); |
+ void* peer; |
+ Dart_Handle str_arg = Dart_GetNativeStringArgument(args, 0, &peer); |
+ EXPECT(Dart_IsString(str_arg)); |
+ EXPECT(!peer); |
intptr_t size = 0; |
EXPECT_VALID(Dart_StringStorageSize(str, &size)); |
+ intptr_t arg_size = 0; |
+ EXPECT_VALID(Dart_StringStorageSize(str_arg, &arg_size)); |
+ EXPECT_EQ(size, arg_size); |
char* str_data = new char[size]; |
Dart_Handle result = |
Dart_MakeExternalString(str, |