| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 137   re_text += "(?:a(x))?"; | 137   re_text += "(?:a(x))?"; | 
| 138   haystack += "bx"; | 138   haystack += "bx"; | 
| 139   var re = new RegExp(re_text); | 139   var re = new RegExp(re_text); | 
| 140   assertTrue(re.test(haystack), "$" + i + " setup"); | 140   assertTrue(re.test(haystack), "$" + i + " setup"); | 
| 141   for (var j = 1; j < i - 1; j++) { | 141   for (var j = 1; j < i - 1; j++) { | 
| 142     assertEquals("x", RegExp['$' + j], "$" + j + " in $" + i + " setup"); | 142     assertEquals("x", RegExp['$' + j], "$" + j + " in $" + i + " setup"); | 
| 143   } | 143   } | 
| 144   assertEquals("", RegExp['$' + (i)], "$" + i); | 144   assertEquals("", RegExp['$' + (i)], "$" + i); | 
| 145 } | 145 } | 
| 146 | 146 | 
| 147 RegExp.multiline = "foo"; |  | 
| 148 assertTrue(typeof RegExp.multiline == typeof Boolean(), "RegExp.multiline coerce
     s values to booleans"); |  | 
| 149 RegExp.input = Number(); | 147 RegExp.input = Number(); | 
| 150 assertTrue(typeof RegExp.input == typeof String(), "RegExp.input coerces values 
     to booleans"); | 148 assertTrue(typeof RegExp.input == typeof String(), "RegExp.input coerces values 
     to booleans"); | 
| 151 | 149 | 
| 152 // Ensure that we save the correct string as the last subject when | 150 // Ensure that we save the correct string as the last subject when | 
| 153 // we do a match on a sliced string (the top one not the underlying). | 151 // we do a match on a sliced string (the top one not the underlying). | 
| 154 var foo = "lsdfj sldkfj sdklfj læsdfjl sdkfjlsdk fjsdl fjsdljskdj flsj flsdkj fl
     skd regexp: /foobar/\nldkfj sdlkfj sdkl"; | 152 var foo = "lsdfj sldkfj sdklfj læsdfjl sdkfjlsdk fjsdl fjsdljskdj flsj flsdkj fl
     skd regexp: /foobar/\nldkfj sdlkfj sdkl"; | 
| 155 assertTrue(/^([a-z]+): (.*)/.test(foo.substring(foo.indexOf("regexp:"))), "regex
     p: setup"); | 153 assertTrue(/^([a-z]+): (.*)/.test(foo.substring(foo.indexOf("regexp:"))), "regex
     p: setup"); | 
| 156 assertEquals("regexp", RegExp.$1, "RegExp.$1"); | 154 assertEquals("regexp", RegExp.$1, "RegExp.$1"); | 
| 157 | 155 | 
| 158 | 156 | 
| 159 // Check that calling with no argument is the same as calling with undefined. | 157 // Check that calling with no argument is the same as calling with undefined. | 
| 160 assertTrue(/^undefined$/.test()); | 158 assertTrue(/^undefined$/.test()); | 
| 161 assertEquals(["undefined"], /^undefined$/.exec()); | 159 assertEquals(["undefined"], /^undefined$/.exec()); | 
| OLD | NEW | 
|---|