OLD | NEW |
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 assertEquals("\u03B1\u03B4\u03B5", utf.substring(0,1) + utf.substring(5,3)); | 186 assertEquals("\u03B1\u03B4\u03B5", utf.substring(0,1) + utf.substring(5,3)); |
187 assertEquals("", ascii.substring(16) + utf.substring(16)); | 187 assertEquals("", ascii.substring(16) + utf.substring(16)); |
188 assertEquals("bcdef\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9", | 188 assertEquals("bcdef\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9", |
189 ascii.substring(1,6) + utf.substring(3,9)); | 189 ascii.substring(1,6) + utf.substring(3,9)); |
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 = "internalized dummy"; |
| 197 a = "123456789" + "qwertyuiopasdfghjklzxcvbnm"; |
197 var b = "23456789qwertyuiopasdfghjklzxcvbn" | 198 var b = "23456789qwertyuiopasdfghjklzxcvbn" |
198 assertEquals(a.slice(1,-1), b); | 199 assertEquals(a.slice(1,-1), b); |
199 | 200 |
200 assertTrue(isOneByteString(a)); | 201 assertTrue(isOneByteString(a)); |
201 externalizeString(a, true); | 202 externalizeString(a, true); |
202 assertFalse(isOneByteString(a)); | 203 assertFalse(isOneByteString(a)); |
203 | 204 |
204 assertEquals(a.slice(1,-1), b); | 205 assertEquals(a.slice(1,-1), b); |
205 assertTrue(/3456789qwe/.test(a)); | 206 assertTrue(/3456789qwe/.test(a)); |
206 assertEquals(5, a.indexOf("678")); | 207 assertEquals(5, a.indexOf("678")); |
(...skipping 20 matching lines...) Expand all Loading... |
227 var s1 = "12345678901234567890"; | 228 var s1 = "12345678901234567890"; |
228 var s2 = "abcdefghijklmnopqrstuvwxyz"; | 229 var s2 = "abcdefghijklmnopqrstuvwxyz"; |
229 var c1 = s1 + s2; | 230 var c1 = s1 + s2; |
230 var c2 = s1 + c1 + s2; | 231 var c2 = s1 + c1 + s2; |
231 assertEquals("234567890123456789", c1.substring(1, 19)); | 232 assertEquals("234567890123456789", c1.substring(1, 19)); |
232 assertEquals("bcdefghijklmno", c1.substring(21, 35)); | 233 assertEquals("bcdefghijklmno", c1.substring(21, 35)); |
233 assertEquals("2345678901234567890abcdefghijklmno", c1.substring(1, 35)); | 234 assertEquals("2345678901234567890abcdefghijklmno", c1.substring(1, 35)); |
234 assertEquals("234567890123456789", c2.substring(1, 19)); | 235 assertEquals("234567890123456789", c2.substring(1, 19)); |
235 assertEquals("bcdefghijklmno", c2.substring(41, 55)); | 236 assertEquals("bcdefghijklmno", c2.substring(41, 55)); |
236 assertEquals("2345678901234567890abcdefghijklmno", c2.substring(21, 55)); | 237 assertEquals("2345678901234567890abcdefghijklmno", c2.substring(21, 55)); |
OLD | NEW |