Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1204)

Unified Diff: test/webkit/fast/js/regexp-extended-characters-crash.js

Issue 20280003: Migrate more tests from blink repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/webkit/fast/js/regexp-extended-characters-crash.js
diff --git a/test/webkit/array-iterate-backwards.js b/test/webkit/fast/js/regexp-extended-characters-crash.js
similarity index 67%
copy from test/webkit/array-iterate-backwards.js
copy to test/webkit/fast/js/regexp-extended-characters-crash.js
index 301cbd5290c9dfafcf44c22b351483aa219212f3..490faadc431b047cbda6a9a81540610f0d20d9f2 100644
--- a/test/webkit/array-iterate-backwards.js
+++ b/test/webkit/fast/js/regexp-extended-characters-crash.js
@@ -22,34 +22,15 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-"This test checks that iterating a large array backwards works correctly."
+'This test checks for a regression against <a href="rdar://problem/4161606">JavaScript regular expressions with certain ranges of Unicode characters cause a crash</a>. If it fails, it may crash.'
);
-var bytes = new Array();
-function prepare(nbytes) {
- var i = nbytes - 1;
- while (i >= 0) {
- bytes[i] = new Number(i);
- i -= 1;
- }
-}
+// test ranges reported in bug
+shouldBe('new RegExp("[\u00c0-\u1f4d]").toString()', '/[\u00c0-\u1f4d]/.toString()');
+shouldBe('new RegExp("[\u3041-\u3094]").toString()', '/[\u3041-\u3094]/.toString()');
+shouldBe('new RegExp("[\u4d00-\u4db5]").toString()', '/[\u4d00-\u4db5]/.toString()');
+shouldBe('new RegExp("[\u4e00-\u9fa5]").toString()', '/[\u4e00-\u9fa5]/.toString()');
-function verify(nbytes) {
- var i = nbytes - 1;
- while (i >= 0) {
- if (bytes[i] != i)
- return false;
- i -= 1;
- }
- return true;
-}
-
-prepare(32768);
-shouldBeTrue('verify(32768)');
-
-prepare(65536);
-shouldBeTrue('verify(65536)');
-
-prepare(120000);
-shouldBeTrue('verify(120000)');
+// test first char < 255, last char > 255
+shouldBe('new RegExp("[\u0001-\u1f4d]").toString()', '/[\u0001-\u1f4d]/.toString()');

Powered by Google App Engine
This is Rietveld 408576698