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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 assertEquals([], "abc".split("", numberObj(0))); | 110 assertEquals([], "abc".split("", numberObj(0))); |
111 assertEquals(["a"], "abc".split("", 1)); | 111 assertEquals(["a"], "abc".split("", 1)); |
112 assertEquals(["a"], "abc".split("", numberObj(1))); | 112 assertEquals(["a"], "abc".split("", numberObj(1))); |
113 assertEquals(["a", "b"], "abc".split("", 2)); | 113 assertEquals(["a", "b"], "abc".split("", 2)); |
114 assertEquals(["a", "b"], "abc".split("", numberObj(2))); | 114 assertEquals(["a", "b"], "abc".split("", numberObj(2))); |
115 assertEquals(["a", "b", "c"], "abc".split("", 3)); | 115 assertEquals(["a", "b", "c"], "abc".split("", 3)); |
116 assertEquals(["a", "b", "c"], "abc".split("", numberObj(3))); | 116 assertEquals(["a", "b", "c"], "abc".split("", numberObj(3))); |
117 assertEquals(["a", "b", "c"], "abc".split("", 4)); | 117 assertEquals(["a", "b", "c"], "abc".split("", 4)); |
118 assertEquals(["a", "b", "c"], "abc".split("", numberObj(4))); | 118 assertEquals(["a", "b", "c"], "abc".split("", numberObj(4))); |
119 | 119 |
120 var all_ascii_chars = []; | 120 |
121 for (var i = 0; i < 128; i++) all_ascii_chars[i] = String.fromCharCode(i); | 121 var all_ascii_codes = []; |
122 var all_ascii_string = all_ascii_chars.join(""); | 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 | 124 |
124 var split_chars = all_ascii_string.split(""); | 125 var split_chars = all_ascii_string.split(""); |
125 assertEquals(128, split_chars.length); | 126 assertEquals(128, split_chars.length); |
126 for (var i = 0; i < 128; i++) { | 127 for (var i = 0; i < 128; i++) { |
127 assertEquals(1, split_chars[i].length); | 128 assertEquals(1, split_chars[i].length); |
128 assertEquals(i, split_chars[i].charCodeAt(0)); | 129 assertEquals(i, split_chars[i].charCodeAt(0)); |
129 } | 130 } |
OLD | NEW |