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

Side by Side Diff: test/mjsunit/string-slices.js

Issue 559913002: Rename ascii to one-byte where applicable. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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
« src/jsregexp.cc ('K') | « test/mjsunit/string-externalize.js ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 assertEquals("\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9abcdefghijklmnop", 190 assertEquals("\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9abcdefghijklmnop",
191 utf.substring(3,9) + ascii); 191 utf.substring(3,9) + ascii);
192 assertEquals("\u03B2\u03B3\u03B4\u03B5\u03B4\u03B5\u03B6\u03B7", 192 assertEquals("\u03B2\u03B3\u03B4\u03B5\u03B4\u03B5\u03B6\u03B7",
193 utf.substring(5,1) + utf.substring(3,7)); 193 utf.substring(5,1) + utf.substring(3,7));
194 194
195 // Externalizing strings. 195 // Externalizing strings.
196 var a = "123456789" + "qwertyuiopasdfghjklzxcvbnm"; 196 var a = "123456789" + "qwertyuiopasdfghjklzxcvbnm";
197 var b = "23456789qwertyuiopasdfghjklzxcvbn" 197 var b = "23456789qwertyuiopasdfghjklzxcvbn"
198 assertEquals(a.slice(1,-1), b); 198 assertEquals(a.slice(1,-1), b);
199 199
200 assertTrue(isAsciiString(a)); 200 assertTrue(isOneByteString(a));
201 externalizeString(a, true); 201 externalizeString(a, true);
202 assertFalse(isAsciiString(a)); 202 assertFalse(isOneByteString(a));
203 203
204 assertEquals(a.slice(1,-1), b); 204 assertEquals(a.slice(1,-1), b);
205 assertTrue(/3456789qwe/.test(a)); 205 assertTrue(/3456789qwe/.test(a));
206 assertEquals(5, a.indexOf("678")); 206 assertEquals(5, a.indexOf("678"));
207 assertEquals("12345", a.split("6")[0]); 207 assertEquals("12345", a.split("6")[0]);
208 208
209 // Create a slice with an external string as parent string. 209 // Create a slice with an external string as parent string.
210 var c = a.slice(1,-1); 210 var c = a.slice(1,-1);
211 211
212 function test_crankshaft() { 212 function test_crankshaft() {
(...skipping 14 matching lines...) Expand all
227 var s1 = "12345678901234567890"; 227 var s1 = "12345678901234567890";
228 var s2 = "abcdefghijklmnopqrstuvwxyz"; 228 var s2 = "abcdefghijklmnopqrstuvwxyz";
229 var c1 = s1 + s2; 229 var c1 = s1 + s2;
230 var c2 = s1 + c1 + s2; 230 var c2 = s1 + c1 + s2;
231 assertEquals("234567890123456789", c1.substring(1, 19)); 231 assertEquals("234567890123456789", c1.substring(1, 19));
232 assertEquals("bcdefghijklmno", c1.substring(21, 35)); 232 assertEquals("bcdefghijklmno", c1.substring(21, 35));
233 assertEquals("2345678901234567890abcdefghijklmno", c1.substring(1, 35)); 233 assertEquals("2345678901234567890abcdefghijklmno", c1.substring(1, 35));
234 assertEquals("234567890123456789", c2.substring(1, 19)); 234 assertEquals("234567890123456789", c2.substring(1, 19));
235 assertEquals("bcdefghijklmno", c2.substring(41, 55)); 235 assertEquals("bcdefghijklmno", c2.substring(41, 55));
236 assertEquals("2345678901234567890abcdefghijklmno", c2.substring(21, 55)); 236 assertEquals("2345678901234567890abcdefghijklmno", c2.substring(21, 55));
OLDNEW
« src/jsregexp.cc ('K') | « test/mjsunit/string-externalize.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698