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(''); |