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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 var test = /^(.)\1$/i.test(String.fromCharCode(i, i ^ 0x20)) | 279 var test = /^(.)\1$/i.test(String.fromCharCode(i, i ^ 0x20)) |
280 var c = String.fromCharCode(i); | 280 var c = String.fromCharCode(i); |
281 if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) { | 281 if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) { |
282 assertTrue(test, testName); | 282 assertTrue(test, testName); |
283 } else { | 283 } else { |
284 assertFalse(test, testName); | 284 assertFalse(test, testName); |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 assertFalse(/f(o)$\1/.test('foo'), "backref detects at_end"); | 288 assertFalse(/f(o)$\1/.test('foo'), "backref detects at_end"); |
| 289 |
| 290 // Check that we don't read past the end of the string. |
| 291 assertFalse(/f/.test('b')); |
| 292 assertFalse(/[abc]f/.test('x')); |
| 293 assertFalse(/[abc]f/.test('xa')); |
| 294 assertFalse(/[abc]</.test('x')); |
| 295 assertFalse(/[abc]</.test('xa')); |
| 296 assertFalse(/f/i.test('b')); |
| 297 assertFalse(/[abc]f/i.test('x')); |
| 298 assertFalse(/[abc]f/i.test('xa')); |
| 299 assertFalse(/[abc]</i.test('x')); |
| 300 assertFalse(/[abc]</i.test('xa')); |
| 301 assertFalse(/f[abc]/.test('x')); |
| 302 assertFalse(/f[abc]/.test('xa')); |
| 303 assertFalse(/<[abc]/.test('x')); |
| 304 assertFalse(/<[abc]/.test('xa')); |
| 305 assertFalse(/f[abc]/i.test('x')); |
| 306 assertFalse(/f[abc]/i.test('xa')); |
| 307 assertFalse(/<[abc]/i.test('x')); |
| 308 assertFalse(/<[abc]/i.test('xa')); |
OLD | NEW |