| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 re = /[^\s\S]/; | 196 re = /[^\s\S]/; |
| 197 assertFalse(re.test('-')); | 197 assertFalse(re.test('-')); |
| 198 assertFalse(re.test(':')); | 198 assertFalse(re.test(':')); |
| 199 assertFalse(re.test(' ')); | 199 assertFalse(re.test(' ')); |
| 200 assertFalse(re.test('\t')); | 200 assertFalse(re.test('\t')); |
| 201 assertFalse(re.test('\n')); | 201 assertFalse(re.test('\n')); |
| 202 assertFalse(re.test('a')); | 202 assertFalse(re.test('a')); |
| 203 assertFalse(re.test('Z')); | 203 assertFalse(re.test('Z')); |
| 204 | 204 |
| 205 // First - is treated as range operator, second as literal minus. |
| 206 // This follows the specification in parsing, but doesn't throw on |
| 207 // the \s at the beginning of the range. |
| 208 re = /[\s-0-9]/; |
| 209 assertTrue(re.test(' ')); |
| 210 assertTrue(re.test('\xA0')); |
| 211 assertTrue(re.test('-')); |
| 212 assertTrue(re.test('0')); |
| 213 assertTrue(re.test('9')); |
| 214 assertFalse(re.test('1')); |
| 215 |
| 205 // Test beginning and end of line assertions with or without the | 216 // Test beginning and end of line assertions with or without the |
| 206 // multiline flag. | 217 // multiline flag. |
| 207 re = /^\d+/; | 218 re = /^\d+/; |
| 208 assertFalse(re.test("asdf\n123")); | 219 assertFalse(re.test("asdf\n123")); |
| 209 re = /^\d+/m; | 220 re = /^\d+/m; |
| 210 assertTrue(re.test("asdf\n123")); | 221 assertTrue(re.test("asdf\n123")); |
| 211 | 222 |
| 212 re = /\d+$/; | 223 re = /\d+$/; |
| 213 assertFalse(re.test("123\nasdf")); | 224 assertFalse(re.test("123\nasdf")); |
| 214 re = /\d+$/m; | 225 re = /\d+$/m; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 | 651 |
| 641 // Only partially anchored. | 652 // Only partially anchored. |
| 642 var re = /(?:a|bc$)/; | 653 var re = /(?:a|bc$)/; |
| 643 assertTrue(re.test("a")); | 654 assertTrue(re.test("a")); |
| 644 assertTrue(re.test("bc")); | 655 assertTrue(re.test("bc")); |
| 645 assertEquals(["a"], re.exec("abc")); | 656 assertEquals(["a"], re.exec("abc")); |
| 646 assertEquals(4, re.exec("zimzamzumba").index); | 657 assertEquals(4, re.exec("zimzamzumba").index); |
| 647 assertEquals(["bc"], re.exec("zimzomzumbc")); | 658 assertEquals(["bc"], re.exec("zimzomzumbc")); |
| 648 assertFalse(re.test("c")); | 659 assertFalse(re.test("c")); |
| 649 assertFalse(re.test("")); | 660 assertFalse(re.test("")); |
| 661 |
| OLD | NEW |