OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 assertEquals(s.substring(s.length - 1), s.substr(-1)); | 50 assertEquals(s.substring(s.length - 1), s.substr(-1)); |
51 assertEquals(s.substring(s.length - 1), s.substr(-1.2)); | 51 assertEquals(s.substring(s.length - 1), s.substr(-1.2)); |
52 assertEquals(s.substring(s.length - 1), s.substr(-1.7)); | 52 assertEquals(s.substring(s.length - 1), s.substr(-1.7)); |
53 assertEquals(s.substring(s.length - 2), s.substr(-2)); | 53 assertEquals(s.substring(s.length - 2), s.substr(-2)); |
54 assertEquals(s.substring(s.length - 2), s.substr(-2.3)); | 54 assertEquals(s.substring(s.length - 2), s.substr(-2.3)); |
55 assertEquals(s.substring(s.length - 2, s.length - 1), s.substr(-2, 1)); | 55 assertEquals(s.substring(s.length - 2, s.length - 1), s.substr(-2, 1)); |
56 assertEquals(s, s.substr(-100)); | 56 assertEquals(s, s.substr(-100)); |
57 assertEquals('abc', s.substr(-100, 3)); | 57 assertEquals('abc', s.substr(-100, 3)); |
58 assertEquals(s1, s.substr(-s.length + 1)); | 58 assertEquals(s1, s.substr(-s.length + 1)); |
59 | 59 |
60 // assertEquals('', s.substr(0, void 0)); // smjs and rhino | 60 // assertEquals('', s.substr(0, void 0)); // smjs and rhino |
61 assertEquals('abcdefghijklmn', s.substr(0, void 0)); // kjs and v8 | 61 assertEquals('abcdefghijklmn', s.substr(0, void 0)); // kjs and v8 |
62 assertEquals('', s.substr(0, null)); | 62 assertEquals('', s.substr(0, null)); |
63 assertEquals(s, s.substr(0, String(s.length))); | 63 assertEquals(s, s.substr(0, String(s.length))); |
64 assertEquals('a', s.substr(0, true)); | 64 assertEquals('a', s.substr(0, true)); |
65 | 65 |
66 | 66 |
67 // Test substrings of different lengths and alignments. | 67 // Test substrings of different lengths and alignments. |
68 // First ASCII. | 68 // First ASCII. |
69 var x = "ASCII"; | 69 var x = "ASCII"; |
70 for (var i = 0; i < 25; i++) { | 70 for (var i = 0; i < 25; i++) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 assertEquals("\u03B2\u03B3\u03B4\u03B5\u03B4\u03B5\u03B6\u03B7", | 189 assertEquals("\u03B2\u03B3\u03B4\u03B5\u03B4\u03B5\u03B6\u03B7", |
190 utf.substring(5,1) + utf.substring(3,7)); | 190 utf.substring(5,1) + utf.substring(3,7)); |
191 | 191 |
192 /* | 192 /* |
193 // Externalizing strings. | 193 // Externalizing strings. |
194 var a = "123456789qwertyuiopasdfghjklzxcvbnm"; | 194 var a = "123456789qwertyuiopasdfghjklzxcvbnm"; |
195 var b = a.slice(1,-1); | 195 var b = a.slice(1,-1); |
196 assertEquals(a.slice(1,-1), b); | 196 assertEquals(a.slice(1,-1), b); |
197 externalizeString(a); | 197 externalizeString(a); |
198 assertEquals(a.slice(1,-1), b); | 198 assertEquals(a.slice(1,-1), b); |
199 */ | 199 */ |
OLD | NEW |