| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // arguments: | 268 // arguments: |
| 269 re = new RegExp(); | 269 re = new RegExp(); |
| 270 // KJS actually shows this as '//'. Here we match the Firefox behavior (ie, | 270 // KJS actually shows this as '//'. Here we match the Firefox behavior (ie, |
| 271 // giving a syntactically legal regexp literal). | 271 // giving a syntactically legal regexp literal). |
| 272 assertEquals('/(?:)/', re.toString()); | 272 assertEquals('/(?:)/', re.toString()); |
| 273 re = new RegExp(void 0); | 273 re = new RegExp(void 0); |
| 274 assertEquals('/(?:)/', re.toString()); | 274 assertEquals('/(?:)/', re.toString()); |
| 275 re.compile(); | 275 re.compile(); |
| 276 assertEquals('/(?:)/', re.toString()); | 276 assertEquals('/(?:)/', re.toString()); |
| 277 re.compile(void 0); | 277 re.compile(void 0); |
| 278 assertEquals('/undefined/', re.toString()); | 278 assertEquals('/(?:)/', re.toString()); |
| 279 | 279 |
| 280 | 280 |
| 281 // Check for lazy RegExp literal creation | 281 // Check for lazy RegExp literal creation |
| 282 function lazyLiteral(doit) { | 282 function lazyLiteral(doit) { |
| 283 if (doit) return "".replace(/foo(/gi, ""); | 283 if (doit) return "".replace(/foo(/gi, ""); |
| 284 return true; | 284 return true; |
| 285 } | 285 } |
| 286 | 286 |
| 287 assertTrue(lazyLiteral(false)); | 287 assertTrue(lazyLiteral(false)); |
| 288 assertThrows("lazyLiteral(true)"); | 288 assertThrows("lazyLiteral(true)"); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 // Test that RegExp.prototype.toString() throws TypeError for | 715 // Test that RegExp.prototype.toString() throws TypeError for |
| 716 // incompatible receivers (ES5 section 15.10.6 and 15.10.6.4). | 716 // incompatible receivers (ES5 section 15.10.6 and 15.10.6.4). |
| 717 assertThrows("RegExp.prototype.toString.call(null)", TypeError); | 717 assertThrows("RegExp.prototype.toString.call(null)", TypeError); |
| 718 assertThrows("RegExp.prototype.toString.call(0)", TypeError); | 718 assertThrows("RegExp.prototype.toString.call(0)", TypeError); |
| 719 assertThrows("RegExp.prototype.toString.call('')", TypeError); | 719 assertThrows("RegExp.prototype.toString.call('')", TypeError); |
| 720 assertThrows("RegExp.prototype.toString.call(false)", TypeError); | 720 assertThrows("RegExp.prototype.toString.call(false)", TypeError); |
| 721 assertThrows("RegExp.prototype.toString.call(true)", TypeError); | 721 assertThrows("RegExp.prototype.toString.call(true)", TypeError); |
| 722 assertThrows("RegExp.prototype.toString.call([])", TypeError); | 722 assertThrows("RegExp.prototype.toString.call([])", TypeError); |
| 723 assertThrows("RegExp.prototype.toString.call({})", TypeError); | 723 assertThrows("RegExp.prototype.toString.call({})", TypeError); |
| 724 assertThrows("RegExp.prototype.toString.call(function(){})", TypeError); | 724 assertThrows("RegExp.prototype.toString.call(function(){})", TypeError); |
| OLD | NEW |