| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 assertFalse(re.test("_")); | 120 assertFalse(re.test("_")); |
| 121 | 121 |
| 122 re = /^[\c$]$/; // Other characters are interpreted literally. | 122 re = /^[\c$]$/; // Other characters are interpreted literally. |
| 123 assertFalse(re.test("\x04")); | 123 assertFalse(re.test("\x04")); |
| 124 assertTrue(re.test("\\")); | 124 assertTrue(re.test("\\")); |
| 125 assertTrue(re.test("c")); | 125 assertTrue(re.test("c")); |
| 126 assertTrue(re.test("$")); | 126 assertTrue(re.test("$")); |
| 127 | 127 |
| 128 assertTrue(/^[Z-\c-e]*$/.test("Z[\\cde")); | 128 assertTrue(/^[Z-\c-e]*$/.test("Z[\\cde")); |
| 129 | 129 |
| 130 // Test that we handle \s and \S correctly on special Unicode characters. |
| 131 re = /\s/; |
| 132 assertTrue(re.test("\u2028")); |
| 133 assertTrue(re.test("\u2029")); |
| 134 assertTrue(re.test("\uFEFF")); |
| 135 |
| 136 re = /\S/; |
| 137 assertFalse(re.test("\u2028")); |
| 138 assertFalse(re.test("\u2029")); |
| 139 assertFalse(re.test("\uFEFF")); |
| 140 |
| 130 // Test that we handle \s and \S correctly inside some bizarre | 141 // Test that we handle \s and \S correctly inside some bizarre |
| 131 // character classes. | 142 // character classes. |
| 132 re = /[\s-:]/; | 143 re = /[\s-:]/; |
| 133 assertTrue(re.test('-')); | 144 assertTrue(re.test('-')); |
| 134 assertTrue(re.test(':')); | 145 assertTrue(re.test(':')); |
| 135 assertTrue(re.test(' ')); | 146 assertTrue(re.test(' ')); |
| 136 assertTrue(re.test('\t')); | 147 assertTrue(re.test('\t')); |
| 137 assertTrue(re.test('\n')); | 148 assertTrue(re.test('\n')); |
| 138 assertFalse(re.test('a')); | 149 assertFalse(re.test('a')); |
| 139 assertFalse(re.test('Z')); | 150 assertFalse(re.test('Z')); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // Syntax extension relative to ES5, for matching JSC (and ES3). | 694 // Syntax extension relative to ES5, for matching JSC (and ES3). |
| 684 // Shouldn't throw. | 695 // Shouldn't throw. |
| 685 re = RegExp("(?=x)*"); | 696 re = RegExp("(?=x)*"); |
| 686 re = RegExp("(?!x)*"); | 697 re = RegExp("(?!x)*"); |
| 687 | 698 |
| 688 // Should throw. Shouldn't hit asserts in debug mode. | 699 // Should throw. Shouldn't hit asserts in debug mode. |
| 689 assertThrows("RegExp('(*)')"); | 700 assertThrows("RegExp('(*)')"); |
| 690 assertThrows("RegExp('(?:*)')"); | 701 assertThrows("RegExp('(?:*)')"); |
| 691 assertThrows("RegExp('(?=*)')"); | 702 assertThrows("RegExp('(?=*)')"); |
| 692 assertThrows("RegExp('(?!*)')"); | 703 assertThrows("RegExp('(?!*)')"); |
| OLD | NEW |