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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 var suffix = add_non_ascii_character_to_subject ? "\ufffe" : ""; | 180 var suffix = add_non_ascii_character_to_subject ? "\ufffe" : ""; |
181 // A range that covers both ASCII and non-ASCII. | 181 // A range that covers both ASCII and non-ASCII. |
182 for (var i = 0; i < 2; i++) { | 182 for (var i = 0; i < 2; i++) { |
183 var full = (i != 0); | 183 var full = (i != 0); |
184 var mixed = full ? "[a-\uffff]" : "[a-" + cyrillic.LAST + "]"; | 184 var mixed = full ? "[a-\uffff]" : "[a-" + cyrillic.LAST + "]"; |
185 var f = full ? "f" : "c"; | 185 var f = full ? "f" : "c"; |
186 for (var j = 0; j < 2; j++) { | 186 for (var j = 0; j < 2; j++) { |
187 var ignore_case = (j == 0); | 187 var ignore_case = (j == 0); |
188 var flag = ignore_case ? "i" : ""; | 188 var flag = ignore_case ? "i" : ""; |
189 var re = new RegExp(mixed, flag); | 189 var re = new RegExp(mixed, flag); |
190 assertEquals(ignore_case || (full && add_non_ascii_character_to_subject), | 190 var expected = |
191 re.test("A" + suffix), | 191 ignore_case || (full && !!add_non_ascii_character_to_subject); |
192 58 + flag + f); | 192 assertEquals(expected, re.test("A" + suffix), 58 + flag + f); |
193 assertTrue(re.test("a" + suffix), 59 + flag + f); | 193 assertTrue(re.test("a" + suffix), 59 + flag + f); |
194 assertTrue(re.test("~" + suffix), 60 + flag + f); | 194 assertTrue(re.test("~" + suffix), 60 + flag + f); |
195 assertTrue(re.test(cyrillic.MIDDLE), 61 + flag + f); | 195 assertTrue(re.test(cyrillic.MIDDLE), 61 + flag + f); |
196 assertEquals(ignore_case || full, re.test(cyrillic.middle), 62 + flag + f)
; | 196 assertEquals(ignore_case || full, re.test(cyrillic.middle), 62 + flag + f)
; |
197 } | 197 } |
198 } | 198 } |
199 } | 199 } |
OLD | NEW |