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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // This was http://b/issue?id=1151354 | 61 // This was http://b/issue?id=1151354 |
62 assertArrayEquals(["div", "#id", ".class"], "div#id.class".split(/(?=[#.])/)); | 62 assertArrayEquals(["div", "#id", ".class"], "div#id.class".split(/(?=[#.])/)); |
63 | 63 |
64 | 64 |
65 assertArrayEquals(["div", "#i", "d", ".class"], "div#id.class".split(/(?=[d#.])/
)); | 65 assertArrayEquals(["div", "#i", "d", ".class"], "div#id.class".split(/(?=[d#.])/
)); |
66 | 66 |
67 assertArrayEquals(["a", "b", "c"], "abc".split(/(?=.)/)); | 67 assertArrayEquals(["a", "b", "c"], "abc".split(/(?=.)/)); |
68 | 68 |
69 | 69 |
70 /* "ab".split(/((?=.))/) | 70 /* "ab".split(/((?=.))/) |
71 * | 71 * |
72 * KJS: ,a,,b | 72 * KJS: ,a,,b |
73 * SM: a,,b, | 73 * SM: a,,b, |
74 * IE: a,b | 74 * IE: a,b |
75 * Opera: a,,b | 75 * Opera: a,,b |
76 * V8: a,,b | 76 * V8: a,,b |
77 * | 77 * |
78 * Opera seems to have this right. The others make no sense. | 78 * Opera seems to have this right. The others make no sense. |
79 */ | 79 */ |
80 assertArrayEquals(["a", "", "b"], "ab".split(/((?=.))/)); | 80 assertArrayEquals(["a", "", "b"], "ab".split(/((?=.))/)); |
81 | 81 |
82 /* "ab".split(/(?=)/) | 82 /* "ab".split(/(?=)/) |
83 * | 83 * |
84 * KJS: a,b | 84 * KJS: a,b |
85 * SM: ab | 85 * SM: ab |
86 * IE: a,b | 86 * IE: a,b |
87 * Opera: a,bb | 87 * Opera: a,bb |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 var all_ascii_codes = []; | 121 var all_ascii_codes = []; |
122 for (var i = 0; i < 128; i++) all_ascii_codes[i] = i; | 122 for (var i = 0; i < 128; i++) all_ascii_codes[i] = i; |
123 var all_ascii_string = String.fromCharCode.apply(String, all_ascii_codes); | 123 var all_ascii_string = String.fromCharCode.apply(String, all_ascii_codes); |
124 | 124 |
125 var split_chars = all_ascii_string.split(""); | 125 var split_chars = all_ascii_string.split(""); |
126 assertEquals(128, split_chars.length); | 126 assertEquals(128, split_chars.length); |
127 for (var i = 0; i < 128; i++) { | 127 for (var i = 0; i < 128; i++) { |
128 assertEquals(1, split_chars[i].length); | 128 assertEquals(1, split_chars[i].length); |
129 assertEquals(i, split_chars[i].charCodeAt(0)); | 129 assertEquals(i, split_chars[i].charCodeAt(0)); |
130 } | 130 } |
OLD | NEW |