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

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

Issue 223653003: Return MaybeHandle from NewExternalStringFrom*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-parsing.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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 }; 1120 };
1121 1121
1122 1122
1123 TEST(SliceFromExternal) { 1123 TEST(SliceFromExternal) {
1124 FLAG_string_slices = true; 1124 FLAG_string_slices = true;
1125 CcTest::InitializeVM(); 1125 CcTest::InitializeVM();
1126 Factory* factory = CcTest::i_isolate()->factory(); 1126 Factory* factory = CcTest::i_isolate()->factory();
1127 v8::HandleScope scope(CcTest::isolate()); 1127 v8::HandleScope scope(CcTest::isolate());
1128 AsciiVectorResource resource( 1128 AsciiVectorResource resource(
1129 i::Vector<const char>("abcdefghijklmnopqrstuvwxyz", 26)); 1129 i::Vector<const char>("abcdefghijklmnopqrstuvwxyz", 26));
1130 Handle<String> string = factory->NewExternalStringFromAscii(&resource); 1130 Handle<String> string =
1131 factory->NewExternalStringFromAscii(&resource).ToHandleChecked();
1131 CHECK(string->IsExternalString()); 1132 CHECK(string->IsExternalString());
1132 Handle<String> slice = factory->NewSubString(string, 1, 25); 1133 Handle<String> slice = factory->NewSubString(string, 1, 25);
1133 CHECK(slice->IsSlicedString()); 1134 CHECK(slice->IsSlicedString());
1134 CHECK(string->IsExternalString()); 1135 CHECK(string->IsExternalString());
1135 CHECK_EQ(SlicedString::cast(*slice)->parent(), *string); 1136 CHECK_EQ(SlicedString::cast(*slice)->parent(), *string);
1136 CHECK(SlicedString::cast(*slice)->parent()->IsExternalString()); 1137 CHECK(SlicedString::cast(*slice)->parent()->IsExternalString());
1137 CHECK(slice->IsFlat()); 1138 CHECK(slice->IsFlat());
1138 } 1139 }
1139 1140
1140 1141
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 dummy.Dispose(); \ 1405 dummy.Dispose(); \
1405 } 1406 }
1406 1407
1407 INVALID_STRING_TEST(NewStringFromAscii, char) 1408 INVALID_STRING_TEST(NewStringFromAscii, char)
1408 INVALID_STRING_TEST(NewStringFromUtf8, char) 1409 INVALID_STRING_TEST(NewStringFromUtf8, char)
1409 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) 1410 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t)
1410 INVALID_STRING_TEST(InternalizeOneByteString, uint8_t) 1411 INVALID_STRING_TEST(InternalizeOneByteString, uint8_t)
1411 INVALID_STRING_TEST(InternalizeUtf8String, char) 1412 INVALID_STRING_TEST(InternalizeUtf8String, char)
1412 1413
1413 #undef INVALID_STRING_TEST 1414 #undef INVALID_STRING_TEST
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698