| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 assertRegExpTest(/[,b]\Bb/, "bb", true); | 477 assertRegExpTest(/[,b]\Bb/, "bb", true); |
| 478 assertRegExpTest(/[,b]\bb/, ",b", true); | 478 assertRegExpTest(/[,b]\bb/, ",b", true); |
| 479 assertRegExpTest(/[,b]\Bb/, ",b", false); | 479 assertRegExpTest(/[,b]\Bb/, ",b", false); |
| 480 | 480 |
| 481 assertRegExpTest(/[,b]\b[,b]/, "bb", false); | 481 assertRegExpTest(/[,b]\b[,b]/, "bb", false); |
| 482 assertRegExpTest(/[,b]\B[,b]/, "bb", true); | 482 assertRegExpTest(/[,b]\B[,b]/, "bb", true); |
| 483 assertRegExpTest(/[,b]\b[,b]/, ",b", true); | 483 assertRegExpTest(/[,b]\b[,b]/, ",b", true); |
| 484 assertRegExpTest(/[,b]\B[,b]/, ",b", false); | 484 assertRegExpTest(/[,b]\B[,b]/, ",b", false); |
| 485 assertRegExpTest(/[,b]\b[,b]/, "b,", true); | 485 assertRegExpTest(/[,b]\b[,b]/, "b,", true); |
| 486 assertRegExpTest(/[,b]\B[,b]/, "b,", false); | 486 assertRegExpTest(/[,b]\B[,b]/, "b,", false); |
| 487 |
| 488 // Test that caching of result doesn't share result objects. |
| 489 // More iterations increases the chance of hitting a GC. |
| 490 for (var i = 0; i < 100; i++) { |
| 491 var re = /x(y)z/; |
| 492 var res = re.exec("axyzb"); |
| 493 assertTrue(!!res); |
| 494 assertEquals(2, res.length); |
| 495 assertEquals("xyz", res[0]); |
| 496 assertEquals("y", res[1]); |
| 497 assertEquals(1, res.index); |
| 498 assertEquals("axyzb", res.input); |
| 499 assertEquals(undefined, res.foobar); |
| 500 |
| 501 res.foobar = "Arglebargle"; |
| 502 res[3] = "Glopglyf"; |
| 503 assertEquals("Arglebargle", res.foobar); |
| 504 } |
| OLD | NEW |