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, "global"); | 608 var desc = Object.getOwnPropertyDescriptor(re.__proto__, "global"); |
609 assertEquals(true, desc.value); | 609 assertInstanceof(desc.get, Function); |
610 assertEquals(false, desc.configurable); | 610 assertEquals(true, desc.configurable); |
Dan Ehrenberg
2015/11/02 19:21:06
Why not leave part of this in, just to check that
| |
611 assertEquals(false, desc.enumerable); | 611 assertEquals(false, desc.enumerable); |
612 assertEquals(false, desc.writable); | |
613 | 612 |
614 desc = Object.getOwnPropertyDescriptor(re, "multiline"); | 613 desc = Object.getOwnPropertyDescriptor(re.__proto__, "multiline"); |
615 assertEquals(false, desc.value); | 614 assertInstanceof(desc.get, Function); |
616 assertEquals(false, desc.configurable); | 615 assertEquals(true, desc.configurable); |
617 assertEquals(false, desc.enumerable); | 616 assertEquals(false, desc.enumerable); |
618 assertEquals(false, desc.writable); | |
619 | 617 |
620 desc = Object.getOwnPropertyDescriptor(re, "ignoreCase"); | 618 desc = Object.getOwnPropertyDescriptor(re.__proto__, "ignoreCase"); |
621 assertEquals(false, desc.value); | 619 assertInstanceof(desc.get, Function); |
622 assertEquals(false, desc.configurable); | 620 assertEquals(true, desc.configurable); |
623 assertEquals(false, desc.enumerable); | 621 assertEquals(false, desc.enumerable); |
624 assertEquals(false, desc.writable); | |
625 | 622 |
626 desc = Object.getOwnPropertyDescriptor(re, "lastIndex"); | 623 desc = Object.getOwnPropertyDescriptor(re, "lastIndex"); |
627 assertEquals(0, desc.value); | 624 assertEquals(0, desc.value); |
628 assertEquals(false, desc.configurable); | 625 assertEquals(false, desc.configurable); |
629 assertEquals(false, desc.enumerable); | 626 assertEquals(false, desc.enumerable); |
630 assertEquals(true, desc.writable); | 627 assertEquals(true, desc.writable); |
631 | 628 |
632 | 629 |
633 // Check that end-anchored regexps are optimized correctly. | 630 // Check that end-anchored regexps are optimized correctly. |
634 var re = /(?:a|bc)g$/; | 631 var re = /(?:a|bc)g$/; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
709 // Test that RegExp.prototype.toString() throws TypeError for | 706 // Test that RegExp.prototype.toString() throws TypeError for |
710 // incompatible receivers (ES5 section 15.10.6 and 15.10.6.4). | 707 // incompatible receivers (ES5 section 15.10.6 and 15.10.6.4). |
711 assertThrows("RegExp.prototype.toString.call(null)", TypeError); | 708 assertThrows("RegExp.prototype.toString.call(null)", TypeError); |
712 assertThrows("RegExp.prototype.toString.call(0)", TypeError); | 709 assertThrows("RegExp.prototype.toString.call(0)", TypeError); |
713 assertThrows("RegExp.prototype.toString.call('')", TypeError); | 710 assertThrows("RegExp.prototype.toString.call('')", TypeError); |
714 assertThrows("RegExp.prototype.toString.call(false)", TypeError); | 711 assertThrows("RegExp.prototype.toString.call(false)", TypeError); |
715 assertThrows("RegExp.prototype.toString.call(true)", TypeError); | 712 assertThrows("RegExp.prototype.toString.call(true)", TypeError); |
716 assertThrows("RegExp.prototype.toString.call([])", TypeError); | 713 assertThrows("RegExp.prototype.toString.call([])", TypeError); |
717 assertThrows("RegExp.prototype.toString.call({})", TypeError); | 714 assertThrows("RegExp.prototype.toString.call({})", TypeError); |
718 assertThrows("RegExp.prototype.toString.call(function(){})", TypeError); | 715 assertThrows("RegExp.prototype.toString.call(function(){})", TypeError); |
OLD | NEW |