| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // 1. Redistributions of source code must retain the above copyright | 7 // 1. Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // 2. Redistributions in binary form must reproduce the above copyright | 9 // 2. Redistributions in binary form must reproduce the above copyright |
| 10 // notice, this list of conditions and the following disclaimer in the | 10 // notice, this list of conditions and the following disclaimer in the |
| 11 // documentation and/or other materials provided with the distribution. | 11 // documentation and/or other materials provided with the distribution. |
| 12 // | 12 // |
| 13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
| 14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
| 17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
| 20 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | 23 |
| 24 description( | 24 description( |
| 25 "Tests the behavior of Array.prototype.concat while the array is having a bad ti
me due to one of the elements we are concatenating." | 25 "Bug 7445, bug 7253: Handle Unicode escapes in regexps." |
| 26 ); | 26 ); |
| 27 | 27 |
| 28 Object.defineProperty(Array.prototype, 0, { writable: false }); | 28 var I3=/^\s*(fwd|re|aw|antw|antwort|wg|sv|ang|odp|betreff|betr|transf|reenv\.|re
env|in|res|resp|resp\.|enc|\u8f6c\u53d1|\u56DE\u590D|\u041F\u0435\u0440\u0435\u0
441\u043B|\u041E\u0442\u0432\u0435\u0442):\s*(.*)$/i; |
| 29 shouldBe("[42].concat()", "[42]"); | |
| 30 | 29 |
| 30 // Other RegExs from Gmail source |
| 31 var Ci=/\s+/g; |
| 32 var BC=/^ /; |
| 33 var BG=/ $/; |
| 31 | 34 |
| 35 // Strips leading Re or similar (from Gmail source) |
| 36 function cy(a) { |
| 37 //var b = I3.exec(a); |
| 38 var b = I3.exec(a); |
| 39 |
| 40 if (b) { |
| 41 a = b[2]; |
| 42 } |
| 43 |
| 44 return Gn(a); |
| 45 } |
| 46 |
| 47 // This function replaces consecutive whitespace with a single space |
| 48 // then removes a leading and trailing space if they exist. (From Gmail) |
| 49 function Gn(a) { |
| 50 return a.replace(Ci, " ").replace(BC, "").replace(BG, ""); |
| 51 } |
| 52 |
| 53 shouldBe('cy("Re: Hello")', '"Hello"'); |
| 54 shouldBe('cy("Ответ: Hello")', '"Hello"'); |
| 55 |
| 56 // --------------------------------------------------------------- |
| 57 |
| 58 var regex = /^([^#<\u2264]+)([#<\u2264])(.*)$/; |
| 59 shouldBe('regex.exec("24#Midnight").toString()', '"24#Midnight,24,#,Midnight"'); |
| OLD | NEW |