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

Side by Side Diff: test/cctest/test-strings.cc

Issue 2759513002: Remove Factory::NewStringFromASCII method. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « test/cctest/parsing/test-scanner-streams.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 for (int j = 0; j < len; j++) { 173 for (int j = 0; j < len; j++) {
174 CHECK_EQ(buf[j], building_blocks[i]->Get(j)); 174 CHECK_EQ(buf[j], building_blocks[i]->Get(j));
175 } 175 }
176 break; 176 break;
177 } 177 }
178 case 1: { 178 case 1: {
179 char buf[2000]; 179 char buf[2000];
180 for (int j = 0; j < len; j++) { 180 for (int j = 0; j < len; j++) {
181 buf[j] = rng->next(0x80); 181 buf[j] = rng->next(0x80);
182 } 182 }
183 building_blocks[i] = factory->NewStringFromAscii( 183 building_blocks[i] =
184 Vector<const char>(buf, len)).ToHandleChecked(); 184 factory->NewStringFromOneByte(OneByteVector(buf, len))
185 .ToHandleChecked();
185 for (int j = 0; j < len; j++) { 186 for (int j = 0; j < len; j++) {
186 CHECK_EQ(buf[j], building_blocks[i]->Get(j)); 187 CHECK_EQ(buf[j], building_blocks[i]->Get(j));
187 } 188 }
188 break; 189 break;
189 } 190 }
190 case 2: { 191 case 2: {
191 uc16* buf = NewArray<uc16>(len); 192 uc16* buf = NewArray<uc16>(len);
192 for (int j = 0; j < len; j++) { 193 for (int j = 0; j < len; j++) {
193 buf[j] = rng->next(0x10000); 194 buf[j] = rng->next(0x10000);
194 } 195 }
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 HandleScope scope(isolate); \ 1586 HandleScope scope(isolate); \
1586 Vector<TYPE> dummy = Vector<TYPE>::New(invalid); \ 1587 Vector<TYPE> dummy = Vector<TYPE>::New(invalid); \
1587 memset(dummy.start(), 0x0, dummy.length() * sizeof(TYPE)); \ 1588 memset(dummy.start(), 0x0, dummy.length() * sizeof(TYPE)); \
1588 CHECK(isolate->factory()->FUN(Vector<const TYPE>::cast(dummy)).is_null()); \ 1589 CHECK(isolate->factory()->FUN(Vector<const TYPE>::cast(dummy)).is_null()); \
1589 memset(dummy.start(), 0x20, dummy.length() * sizeof(TYPE)); \ 1590 memset(dummy.start(), 0x20, dummy.length() * sizeof(TYPE)); \
1590 CHECK(isolate->has_pending_exception()); \ 1591 CHECK(isolate->has_pending_exception()); \
1591 isolate->clear_pending_exception(); \ 1592 isolate->clear_pending_exception(); \
1592 dummy.Dispose(); \ 1593 dummy.Dispose(); \
1593 } 1594 }
1594 1595
1595 INVALID_STRING_TEST(NewStringFromAscii, char)
1596 INVALID_STRING_TEST(NewStringFromUtf8, char) 1596 INVALID_STRING_TEST(NewStringFromUtf8, char)
1597 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) 1597 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t)
1598 1598
1599 #undef INVALID_STRING_TEST 1599 #undef INVALID_STRING_TEST
1600 1600
1601 1601
1602 TEST(FormatMessage) { 1602 TEST(FormatMessage) {
1603 CcTest::InitializeVM(); 1603 CcTest::InitializeVM();
1604 LocalContext context; 1604 LocalContext context;
1605 Isolate* isolate = CcTest::i_isolate(); 1605 Isolate* isolate = CcTest::i_isolate();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 CHECK_EQ(1, CompileRun("external.indexOf('', 1)") 1664 CHECK_EQ(1, CompileRun("external.indexOf('', 1)")
1665 ->Int32Value(context.local()) 1665 ->Int32Value(context.local())
1666 .FromJust()); 1666 .FromJust());
1667 CHECK_EQ(-1, CompileRun("external.indexOf('a', 1)") 1667 CHECK_EQ(-1, CompileRun("external.indexOf('a', 1)")
1668 ->Int32Value(context.local()) 1668 ->Int32Value(context.local())
1669 .FromJust()); 1669 .FromJust());
1670 CHECK_EQ(-1, CompileRun("external.indexOf('$')") 1670 CHECK_EQ(-1, CompileRun("external.indexOf('$')")
1671 ->Int32Value(context.local()) 1671 ->Int32Value(context.local())
1672 .FromJust()); 1672 .FromJust());
1673 } 1673 }
OLDNEW
« no previous file with comments | « test/cctest/parsing/test-scanner-streams.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698