Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: test/cctest/test-api.cc

Issue 14638003: deprecate WriteAscii and MayContainNonAscii (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index d0b986b796e61f1c2a4e90d9e3fb930e3b2ac881..9e653ad71070015d7efe8daffe8da0b94ae6cb1b 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -289,8 +289,8 @@ THREADED_TEST(HulIgennem) {
v8::HandleScope scope(env->GetIsolate());
v8::Handle<v8::Primitive> undef = v8::Undefined();
Local<String> undef_str = undef->ToString();
- char* value = i::NewArray<char>(undef_str->Length() + 1);
- undef_str->WriteAscii(value);
+ char* value = i::NewArray<char>(undef_str->Utf8Length() + 1);
+ undef_str->WriteUtf8(value);
CHECK_EQ(0, strcmp(value, "undefined"));
i::DeleteArray(value);
}
@@ -6542,7 +6542,7 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteAscii(buf);
+ len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf));
CHECK_EQ(5, len);
len = str->Write(wbuf);
CHECK_EQ(5, len);
@@ -6552,7 +6552,7 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteAscii(buf, 0, 4);
+ len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 0, 4);
CHECK_EQ(4, len);
len = str->Write(wbuf, 0, 4);
CHECK_EQ(4, len);
@@ -6562,7 +6562,7 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteAscii(buf, 0, 5);
+ len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 0, 5);
CHECK_EQ(5, len);
len = str->Write(wbuf, 0, 5);
CHECK_EQ(5, len);
@@ -6572,7 +6572,7 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteAscii(buf, 0, 6);
+ len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 0, 6);
CHECK_EQ(5, len);
len = str->Write(wbuf, 0, 6);
CHECK_EQ(5, len);
@@ -6582,7 +6582,7 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteAscii(buf, 4, -1);
+ len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 4, -1);
CHECK_EQ(1, len);
len = str->Write(wbuf, 4, -1);
CHECK_EQ(1, len);
@@ -6592,7 +6592,7 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteAscii(buf, 4, 6);
+ len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 4, 6);
CHECK_EQ(1, len);
len = str->Write(wbuf, 4, 6);
CHECK_EQ(1, len);
@@ -6601,7 +6601,7 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteAscii(buf, 4, 1);
+ len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 4, 1);
CHECK_EQ(1, len);
len = str->Write(wbuf, 4, 1);
CHECK_EQ(1, len);
@@ -6611,7 +6611,7 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteAscii(buf, 3, 1);
+ len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 3, 1);
CHECK_EQ(1, len);
len = str->Write(wbuf, 3, 1);
CHECK_EQ(1, len);
@@ -6633,7 +6633,10 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
buf[5] = 'X';
- len = str->WriteAscii(buf, 0, 6, String::NO_NULL_TERMINATION);
+ len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf),
+ 0,
+ 6,
+ String::NO_NULL_TERMINATION);
CHECK_EQ(5, len);
CHECK_EQ('X', buf[5]);
CHECK_EQ(0, strncmp("abcde", buf, 5));
@@ -6664,18 +6667,13 @@ THREADED_TEST(StringWrite) {
CHECK_EQ(0, strcmp(utf8buf, "abcde"));
memset(buf, 0x1, sizeof(buf));
- len = str3->WriteAscii(buf);
- CHECK_EQ(7, len);
- CHECK_EQ(0, strcmp("abc def", buf));
-
- memset(buf, 0x1, sizeof(buf));
- len = str3->WriteAscii(buf, 0, -1, String::PRESERVE_ASCII_NULL);
+ len = str3->WriteOneByte(reinterpret_cast<uint8_t*>(buf));
CHECK_EQ(7, len);
CHECK_EQ(0, strcmp("abc", buf));
CHECK_EQ(0, buf[3]);
CHECK_EQ(0, strcmp("def", buf + 4));
- CHECK_EQ(0, str->WriteAscii(NULL, 0, 0, String::NO_NULL_TERMINATION));
+ CHECK_EQ(0, str->WriteOneByte(NULL, 0, 0, String::NO_NULL_TERMINATION));
CHECK_EQ(0, str->WriteUtf8(NULL, 0, 0, String::NO_NULL_TERMINATION));
CHECK_EQ(0, str->Write(NULL, 0, 0, String::NO_NULL_TERMINATION));
}
@@ -8238,7 +8236,7 @@ static bool NamedAccessFlatten(Local<v8::Object> global,
CHECK(name->IsString());
memset(buf, 0x1, sizeof(buf));
- len = name.As<String>()->WriteAscii(buf);
+ len = name.As<String>()->WriteOneByte(reinterpret_cast<uint8_t*>(buf));
CHECK_EQ(4, len);
uint16_t buf2[100];
« no previous file with comments | « src/debug.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698