Index: test/mjsunit/regress/regress-latin-1.js |
diff --git a/test/mjsunit/regress/regress-crbug-146910.js b/test/mjsunit/regress/regress-latin-1.js |
similarity index 66% |
copy from test/mjsunit/regress/regress-crbug-146910.js |
copy to test/mjsunit/regress/regress-latin-1.js |
index 1b2a60af7fd3fe2e23ef5a8589e6b81d425d2fd5..b1f006d95f6effc40c4997730a905203476c538b 100644 |
--- a/test/mjsunit/regress/regress-crbug-146910.js |
+++ b/test/mjsunit/regress/regress-latin-1.js |
@@ -28,6 +28,32 @@ |
assertEquals(String.fromCharCode(97, 220, 256), 'a' + '\u00DC' + '\u0100'); |
assertEquals(String.fromCharCode(97, 220, 256), 'a\u00DC\u0100'); |
+assertEquals(0x80, JSON.stringify("\x80").charCodeAt(1)); |
+ |
assertEquals(['a', 'b', '\xdc'], ['b', '\xdc', 'a'].sort()); |
-assertEquals(['\xfc\xdc', '\xfc'], new RegExp('(\xdc)\\1', 'i').exec('\xfc\xdc')); |
+assertEquals(['\xfc\xdc', '\xfc'], new RegExp('(\xdc)\\1', 'i').exec('\xfc\xdc')); |
+// Same test but for all values in Latin-1 range. |
+var total_lo = 0; |
+for (var i = 0; i < 0xff; i++) { |
+ var base = String.fromCharCode(i); |
+ var escaped = base; |
+ if (base == '(' || base == ')' || base == '*' || base == '+' || |
+ base == '?' || base == '[' || base == ']' || base == '\\' || |
+ base == '$' || base == '^' || base == '|') { |
+ escaped = '\\' + base; |
+ } |
+ var lo = String.fromCharCode(i + 0x20); |
+ base_result = new RegExp('(' + escaped + ')\\1', 'i').exec(base + base); |
+ assertEquals( base_result, [base + base, base]); |
+ lo_result = new RegExp('(' + escaped + ')\\1', 'i').exec(base + lo); |
+ if (base.toLowerCase() == lo) { |
+ assertEquals([base + lo, base], lo_result); |
+ total_lo++; |
+ } else { |
+ assertEquals(null, lo_result); |
+ } |
+} |
+// Should have hit the branch for the following char codes: |
+// [A-Z], [192-222] but not 215 |
+assertEquals((90-65+1)+(222-192-1+1), total_lo); |