summaryrefslogtreecommitdiffstats
path: root/test/mjsunit/regexp.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/mjsunit/regexp.js')
-rw-r--r--test/mjsunit/regexp.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/mjsunit/regexp.js b/test/mjsunit/regexp.js
index b57b86d2..4c1d2e31 100644
--- a/test/mjsunit/regexp.js
+++ b/test/mjsunit/regexp.js
@@ -202,6 +202,17 @@ assertFalse(re.test('\n'));
assertFalse(re.test('a'));
assertFalse(re.test('Z'));
+// First - is treated as range operator, second as literal minus.
+// This follows the specification in parsing, but doesn't throw on
+// the \s at the beginning of the range.
+re = /[\s-0-9]/;
+assertTrue(re.test(' '));
+assertTrue(re.test('\xA0'));
+assertTrue(re.test('-'));
+assertTrue(re.test('0'));
+assertTrue(re.test('9'));
+assertFalse(re.test('1'));
+
// Test beginning and end of line assertions with or without the
// multiline flag.
re = /^\d+/;
@@ -647,3 +658,4 @@ assertEquals(4, re.exec("zimzamzumba").index);
assertEquals(["bc"], re.exec("zimzomzumbc"));
assertFalse(re.test("c"));
assertFalse(re.test(""));
+