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

Unified Diff: test/webkit/regexp-non-bmp.js

Issue 18068003: Migrated several tests from blink to V8 repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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/regexp-non-bmp.js
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/regexp-non-bmp.js
similarity index 62%
copy from test/webkit/concat-while-having-a-bad-time.js
copy to test/webkit/regexp-non-bmp.js
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..071125112221ba207642b446280c962af6b1b1bf 100644
--- a/test/webkit/concat-while-having-a-bad-time.js
+++ b/test/webkit/regexp-non-bmp.js
@@ -22,10 +22,23 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating."
+'Tests that regular expressions treat non-BMP characters as two separate characters. '
++ 'From a Unicode correctness point of view this is wrong, but it is what other browsers do. '
++ 'And given that we store strings as UTF-16, it is also more efficient to implement. '
++ 'Also test some other cases related to UTF-8 and UTF-16.'
);
-Object.defineProperty(Array.prototype, 0, { writable: false });
-shouldBe("[42].concat()", "[42]");
+var surrogatePair = String.fromCharCode(0xD800) + String.fromCharCode(0xDC00);
+shouldBe('/./.exec(surrogatePair).toString().length', '1');
+shouldBe('/\\D/.exec(surrogatePair).toString().length', '1');
+shouldBe('/\\S/.exec(surrogatePair).toString().length', '1');
+shouldBe('/\\W/.exec(surrogatePair).toString().length', '1');
+shouldBe('/[^x]/.exec(surrogatePair).toString().length', '1');
+debug('');
+
+shouldBe('/.{1,2}/.exec("!!" + String.fromCharCode(0xA1)).toString().length', '2');
+shouldBe('/./.exec("")', 'null');
+
+debug('');
« no previous file with comments | « test/webkit/regexp-negative-special-characters-expected.txt ('k') | test/webkit/regexp-non-bmp-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698