summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_2/regexp/question_mark.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/js1_2/regexp/question_mark.js')
-rw-r--r--js/src/tests/js1_2/regexp/question_mark.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/js/src/tests/js1_2/regexp/question_mark.js b/js/src/tests/js1_2/regexp/question_mark.js
new file mode 100644
index 000000000..e159be8bb
--- /dev/null
+++ b/js/src/tests/js1_2/regexp/question_mark.js
@@ -0,0 +1,67 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+/**
+ Filename: question_mark.js
+ Description: 'Tests regular expressions containing ?'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+var VERSION = 'no version';
+startTest();
+var TITLE = 'RegExp: ?';
+
+writeHeaderToLog('Executing script: question_mark.js');
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// 'abcdef'.match(new RegExp('cd?e'))
+new TestCase ( SECTION, "'abcdef'.match(new RegExp('cd?e'))",
+ String(["cde"]), String('abcdef'.match(new RegExp('cd?e'))));
+
+// 'abcdef'.match(new RegExp('cdx?e'))
+new TestCase ( SECTION, "'abcdef'.match(new RegExp('cdx?e'))",
+ String(["cde"]), String('abcdef'.match(new RegExp('cdx?e'))));
+
+// 'pqrstuvw'.match(new RegExp('o?pqrst'))
+new TestCase ( SECTION, "'pqrstuvw'.match(new RegExp('o?pqrst'))",
+ String(["pqrst"]), String('pqrstuvw'.match(new RegExp('o?pqrst'))));
+
+// 'abcd'.match(new RegExp('x?y?z?'))
+new TestCase ( SECTION, "'abcd'.match(new RegExp('x?y?z?'))",
+ String([""]), String('abcd'.match(new RegExp('x?y?z?'))));
+
+// 'abcd'.match(new RegExp('x?ay?bz?c'))
+new TestCase ( SECTION, "'abcd'.match(new RegExp('x?ay?bz?c'))",
+ String(["abc"]), String('abcd'.match(new RegExp('x?ay?bz?c'))));
+
+// 'abcd'.match(/x?ay?bz?c/)
+new TestCase ( SECTION, "'abcd'.match(/x?ay?bz?c/)",
+ String(["abc"]), String('abcd'.match(/x?ay?bz?c/)));
+
+// 'abbbbc'.match(new RegExp('b?b?b?b'))
+new TestCase ( SECTION, "'abbbbc'.match(new RegExp('b?b?b?b'))",
+ String(["bbbb"]), String('abbbbc'.match(new RegExp('b?b?b?b'))));
+
+// '123az789'.match(new RegExp('ab?c?d?x?y?z'))
+new TestCase ( SECTION, "'123az789'.match(new RegExp('ab?c?d?x?y?z'))",
+ String(["az"]), String('123az789'.match(new RegExp('ab?c?d?x?y?z'))));
+
+// '123az789'.match(/ab?c?d?x?y?z/)
+new TestCase ( SECTION, "'123az789'.match(/ab?c?d?x?y?z/)",
+ String(["az"]), String('123az789'.match(/ab?c?d?x?y?z/)));
+
+// '?????'.match(new RegExp('\\??\\??\\??\\??\\??'))
+new TestCase ( SECTION, "'?????'.match(new RegExp('\\??\\??\\??\\??\\??'))",
+ String(["?????"]), String('?????'.match(new RegExp('\\??\\??\\??\\??\\??'))));
+
+// 'test'.match(new RegExp('.?.?.?.?.?.?.?'))
+new TestCase ( SECTION, "'test'.match(new RegExp('.?.?.?.?.?.?.?'))",
+ String(["test"]), String('test'.match(new RegExp('.?.?.?.?.?.?.?'))));
+
+test();