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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 counter = 0; | 157 counter = 0; |
158 var subject = { toString: function() { assertEquals(0, counter); | 158 var subject = { toString: function() { assertEquals(0, counter); |
159 counter++; | 159 counter++; |
160 return "abc"; }}; | 160 return "abc"; }}; |
161 separator = { toString: function() { assertEquals(1, counter); | 161 separator = { toString: function() { assertEquals(1, counter); |
162 counter++; | 162 counter++; |
163 return "b"; }}; | 163 return "b"; }}; |
164 | 164 |
165 assertEquals(["a", "c"], String.prototype.split.call(subject, separator)); | 165 assertEquals(["a", "c"], String.prototype.split.call(subject, separator)); |
166 assertEquals(2, counter); | 166 assertEquals(2, counter); |
| 167 |
| 168 // Check ToUint32 conversion of limit. |
| 169 assertArrayEquals(["a"], "a,b,c,d,e,f".split(/,/, -4294967295)); |
| 170 assertArrayEquals(["a"], "a,b,c,d,e,f".split(/,/, -4294967294.5)); |
| 171 assertArrayEquals(["a", "b"], "a,b,c,d,e,f".split(/,/, -4294967294)); |
| 172 assertArrayEquals(["a", "b", "c"], "a,b,c,d,e,f".split(/,/, -4294967293)); |
| 173 assertArrayEquals(["a", "b", "c", "d"], "a,b,c,d,e,f".split(/,/, -4294967292)); |
| 174 assertArrayEquals(["a", "b", "c", "d", "e", "f"], "a,b,c,d,e,f".split(/,/, -1)); |
OLD | NEW |