| 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 // And one more time, just to be certain. | 598 // And one more time, just to be certain. |
| 599 log = []; | 599 log = []; |
| 600 re.lastIndex = fakeLastIndex; | 600 re.lastIndex = fakeLastIndex; |
| 601 result = re.exec(fakeString); | 601 result = re.exec(fakeString); |
| 602 assertEquals(["str"], result); | 602 assertEquals(["str"], result); |
| 603 assertEquals(["ts", "li"], log); | 603 assertEquals(["ts", "li"], log); |
| 604 | 604 |
| 605 | 605 |
| 606 // Check that properties of RegExp have the correct permissions. | 606 // Check that properties of RegExp have the correct permissions. |
| 607 var re = /x/g; | 607 var re = /x/g; |
| 608 var desc = Object.getOwnPropertyDescriptor(re.__proto__, "global"); | 608 var desc = Object.getOwnPropertyDescriptor(re, "global"); |
| 609 assertInstanceof(desc.get, Function); | 609 assertEquals(true, desc.value); |
| 610 assertEquals(true, desc.configurable); | 610 assertEquals(false, desc.configurable); |
| 611 assertEquals(false, desc.enumerable); | 611 assertEquals(false, desc.enumerable); |
| 612 | 612 assertEquals(false, desc.writable); |
| 613 desc = Object.getOwnPropertyDescriptor(re.__proto__, "multiline"); | |
| 614 assertInstanceof(desc.get, Function); | |
| 615 assertEquals(true, desc.configurable); | |
| 616 assertEquals(false, desc.enumerable); | |
| 617 | |
| 618 desc = Object.getOwnPropertyDescriptor(re.__proto__, "ignoreCase"); | |
| 619 assertInstanceof(desc.get, Function); | |
| 620 assertEquals(true, desc.configurable); | |
| 621 assertEquals(false, desc.enumerable); | |
| 622 | |
| 623 desc = Object.getOwnPropertyDescriptor(re, "global"); | |
| 624 assertEquals(undefined, desc); | |
| 625 | 613 |
| 626 desc = Object.getOwnPropertyDescriptor(re, "multiline"); | 614 desc = Object.getOwnPropertyDescriptor(re, "multiline"); |
| 627 assertEquals(undefined, desc); | 615 assertEquals(false, desc.value); |
| 616 assertEquals(false, desc.configurable); |
| 617 assertEquals(false, desc.enumerable); |
| 618 assertEquals(false, desc.writable); |
| 628 | 619 |
| 629 desc = Object.getOwnPropertyDescriptor(re, "ignoreCase"); | 620 desc = Object.getOwnPropertyDescriptor(re, "ignoreCase"); |
| 630 assertEquals(undefined, desc); | 621 assertEquals(false, desc.value); |
| 622 assertEquals(false, desc.configurable); |
| 623 assertEquals(false, desc.enumerable); |
| 624 assertEquals(false, desc.writable); |
| 631 | 625 |
| 632 desc = Object.getOwnPropertyDescriptor(re, "lastIndex"); | 626 desc = Object.getOwnPropertyDescriptor(re, "lastIndex"); |
| 633 assertEquals(0, desc.value); | 627 assertEquals(0, desc.value); |
| 634 assertEquals(false, desc.configurable); | 628 assertEquals(false, desc.configurable); |
| 635 assertEquals(false, desc.enumerable); | 629 assertEquals(false, desc.enumerable); |
| 636 assertEquals(true, desc.writable); | 630 assertEquals(true, desc.writable); |
| 637 | 631 |
| 638 | 632 |
| 639 // Check that end-anchored regexps are optimized correctly. | 633 // Check that end-anchored regexps are optimized correctly. |
| 640 var re = /(?:a|bc)g$/; | 634 var re = /(?:a|bc)g$/; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 // Test that RegExp.prototype.toString() throws TypeError for | 709 // Test that RegExp.prototype.toString() throws TypeError for |
| 716 // incompatible receivers (ES5 section 15.10.6 and 15.10.6.4). | 710 // incompatible receivers (ES5 section 15.10.6 and 15.10.6.4). |
| 717 assertThrows("RegExp.prototype.toString.call(null)", TypeError); | 711 assertThrows("RegExp.prototype.toString.call(null)", TypeError); |
| 718 assertThrows("RegExp.prototype.toString.call(0)", TypeError); | 712 assertThrows("RegExp.prototype.toString.call(0)", TypeError); |
| 719 assertThrows("RegExp.prototype.toString.call('')", TypeError); | 713 assertThrows("RegExp.prototype.toString.call('')", TypeError); |
| 720 assertThrows("RegExp.prototype.toString.call(false)", TypeError); | 714 assertThrows("RegExp.prototype.toString.call(false)", TypeError); |
| 721 assertThrows("RegExp.prototype.toString.call(true)", TypeError); | 715 assertThrows("RegExp.prototype.toString.call(true)", TypeError); |
| 722 assertThrows("RegExp.prototype.toString.call([])", TypeError); | 716 assertThrows("RegExp.prototype.toString.call([])", TypeError); |
| 723 assertThrows("RegExp.prototype.toString.call({})", TypeError); | 717 assertThrows("RegExp.prototype.toString.call({})", TypeError); |
| 724 assertThrows("RegExp.prototype.toString.call(function(){})", TypeError); | 718 assertThrows("RegExp.prototype.toString.call(function(){})", TypeError); |
| OLD | NEW |