| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Tests taken from: | 5 // Tests taken from: |
| 6 // http://mathias.html5.org/tests/javascript/string/ | 6 // http://mathias.html5.org/tests/javascript/string/ |
| 7 | 7 |
| 8 assertEquals('_'.anchor('b'), '<a name="b">_</a>'); | 8 assertEquals('_'.anchor('b'), '<a name="b">_</a>'); |
| 9 assertEquals('<'.anchor('<'), '<a name="<"><</a>'); | 9 assertEquals('<'.anchor('<'), '<a name="<"><</a>'); |
| 10 assertEquals('_'.anchor(0x2A), '<a name="42">_</a>'); | 10 assertEquals('_'.anchor(0x2A), '<a name="42">_</a>'); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 'strike', | 185 'strike', |
| 186 'sub', | 186 'sub', |
| 187 'sup', | 187 'sup', |
| 188 ]; | 188 ]; |
| 189 for (var name of methodNames) { | 189 for (var name of methodNames) { |
| 190 calls = 0; | 190 calls = 0; |
| 191 String.prototype[name].call(obj); | 191 String.prototype[name].call(obj); |
| 192 assertEquals(1, calls); | 192 assertEquals(1, calls); |
| 193 } | 193 } |
| 194 })(); | 194 })(); |
| 195 |
| 196 |
| 197 (function TestDeleteStringRelace() { |
| 198 assertEquals('<a name="n">s</a>', 's'.anchor('n')); |
| 199 assertTrue(delete String.prototype.replace); |
| 200 assertEquals('<a name="n">s</a>', 's'.anchor('n')); |
| 201 })(); |
| OLD | NEW |