Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 function Test(lower, upper) { | |
| 6 assertEquals(lower + "x", new RegExp(upper + "x|" + lower + "|" + lower + "cat ", "i").exec(lower + "x") + ""); | |
| 7 assertEquals(upper + "x", new RegExp(upper + "x|" + lower + "|" + lower + "cat ", "i").exec(upper + "x") + ""); | |
| 8 assertEquals(lower, new RegExp(lower + "|" + upper + "x|" + lower + "cat", "i" ).exec(lower + "x") + ""); | |
| 9 assertEquals(upper, new RegExp(lower + "|" + upper + "x|" + lower + "cat", "i" ).exec(upper + "x") + ""); | |
| 10 } | |
| 11 | |
| 12 function TestFail(lower, upper) { | |
| 13 assertEquals(lower, new RegExp(upper + "x|" + lower + "|" + lower + "cat", "i" ).exec(lower + "x") + ""); | |
| 14 assertEquals(upper + "x", new RegExp(upper + "x|" + lower + "|" + lower + "cat ", "i").exec(upper + "x") + ""); | |
| 15 assertEquals(lower, new RegExp(lower + "|" + upper + "x|" + lower + "cat", "i" ).exec(lower + "x") + ""); | |
| 16 assertEquals(upper + "x", new RegExp(lower + "|" + upper + "x|" + lower + "cat ", "i").exec(upper + "x") + ""); | |
| 17 } | |
| 18 | |
| 19 Test("a", "A"); | |
| 20 Test("0", "0"); | |
| 21 TestFail("a", "b"); | |
| 22 // Small and capital o-umlaut | |
| 23 Test(String.fromCharCode(0xf6), String.fromCharCode(0xd6)); | |
| 24 // Small and capital kha. | |
| 25 Test(String.fromCharCode(0x445), String.fromCharCode(0x425)); | |
| 26 // Small and capital y-umlaut. | |
| 27 Test(String.fromCharCode(0xff), String.fromCharCode(0x178)); | |
| 28 // Small and large Greek mu. | |
| 29 Test(String.fromCharCode(0x3bc), String.fromCharCode(0x39c)); | |
| 30 // Micron and large Greek mu. | |
| 31 Test(String.fromCharCode(0xb5), String.fromCharCode(0x39c)); | |
| 32 // Micron and small Greek mu. | |
| 33 Test(String.fromCharCode(0xb5), String.fromCharCode(0x3bc)); | |
|
Erik Corry Chromium.org
2015/06/17 07:21:13
Firefox fails this. I think we are doing it right
| |
| 34 // German double s and capital S. These are not equivalent since one is double. | |
| 35 TestFail(String.fromCharCode(0xdf), "S"); | |
| 36 // Small i and Turkish capital dotted I. These are not equivalent due to | |
| 37 // 21.2.2.8.2 section 3g. One is below 128 and the other is above 127. | |
| 38 TestFail("i", String.fromCharCode(0x130)); | |
| 39 // Small dotless i and I. These are not equivalent either. | |
| 40 TestFail(String.fromCharCode(0x131), "I"); | |
| OLD | NEW |