| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 replaceTest("[]axbxcx", short, /x()/, "[$1]"); | 97 replaceTest("[]axbxcx", short, /x()/, "[$1]"); |
| 98 replaceTest("[$1]a[$1]b[$1]c[$1]", short, /x/g, "[$1]"); | 98 replaceTest("[$1]a[$1]b[$1]c[$1]", short, /x/g, "[$1]"); |
| 99 replaceTest("[]a[]b[]c[]", short, /x()/g, "[$1]"); | 99 replaceTest("[]a[]b[]c[]", short, /x()/g, "[$1]"); |
| 100 | 100 |
| 101 replaceTest("xax[$1]xcx", short, "b", "[$1]"); | 101 replaceTest("xax[$1]xcx", short, "b", "[$1]"); |
| 102 replaceTest("xax[$1]xcx", short, /b/, "[$1]"); | 102 replaceTest("xax[$1]xcx", short, /b/, "[$1]"); |
| 103 replaceTest("xax[]xcx", short, /b()/, "[$1]"); | 103 replaceTest("xax[]xcx", short, /b()/, "[$1]"); |
| 104 replaceTest("xax[$1]xcx", short, /b/g, "[$1]"); | 104 replaceTest("xax[$1]xcx", short, /b/g, "[$1]"); |
| 105 replaceTest("xax[]xcx", short, /b()/g, "[$1]"); | 105 replaceTest("xax[]xcx", short, /b()/g, "[$1]"); |
| 106 | 106 |
| 107 // Bug 317 look-alikes. If "$e" has no meaning, the "$" must be retained. |
| 108 replaceTest("xax$excx", short, "b", "$e"); |
| 109 replaceTest("xax$excx", short, /b/, "$e"); |
| 110 replaceTest("xax$excx", short, /b/g, "$e"); |
| 111 |
| 112 replaceTest("xaxe$xcx", short, "b", "e$"); |
| 113 replaceTest("xaxe$xcx", short, /b/, "e$"); |
| 114 replaceTest("xaxe$xcx", short, /b/g, "e$"); |
| 115 |
| 107 | 116 |
| 108 replaceTest("[$$$1$$a1abb1bb0$002$3$03][$$$1$$b1bcc1cc0$002$3$03]c", | 117 replaceTest("[$$$1$$a1abb1bb0$002$3$03][$$$1$$b1bcc1cc0$002$3$03]c", |
| 109 "abc", /(.)(?=(.))/g, "[$$$$$$1$$$$$11$01$2$21$02$020$002$3$03]"); | 118 "abc", /(.)(?=(.))/g, "[$$$$$$1$$$$$11$01$2$21$02$020$002$3$03]"); |
| 110 | 119 |
| 111 // Replace with functions. | 120 // Replace with functions. |
| 112 | 121 |
| 113 | 122 |
| 114 var ctr = 0; | 123 var ctr = 0; |
| 115 replaceTest("0axbxcx", short, "x", function r(m, i, s) { | 124 replaceTest("0axbxcx", short, "x", function r(m, i, s) { |
| 116 assertEquals(3, arguments.length, "replace('x',func) func-args"); | 125 assertEquals(3, arguments.length, "replace('x',func) func-args"); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 longstring = longstring + longstring; | 173 longstring = longstring + longstring; |
| 165 longstring = longstring + longstring; | 174 longstring = longstring + longstring; |
| 166 longstring = longstring + longstring; | 175 longstring = longstring + longstring; |
| 167 longstring = longstring + longstring; | 176 longstring = longstring + longstring; |
| 168 longstring = longstring + longstring; | 177 longstring = longstring + longstring; |
| 169 longstring = longstring + longstring; | 178 longstring = longstring + longstring; |
| 170 // longstring.length == 5 << 11 | 179 // longstring.length == 5 << 11 |
| 171 | 180 |
| 172 replaceTest(longstring + longstring, | 181 replaceTest(longstring + longstring, |
| 173 "<" + longstring + ">", /<(.*)>/g, "$1$1"); | 182 "<" + longstring + ">", /<(.*)>/g, "$1$1"); |
| OLD | NEW |