Jacek Caban : jscript: Added RegExp tests.
Alexandre Julliard
julliard at winehq.org
Tue Sep 16 06:54:23 CDT 2008
Module: wine
Branch: master
Commit: 4b9bc9816b268f855fa25524f0b20a94062385b0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4b9bc9816b268f855fa25524f0b20a94062385b0
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Sep 15 20:41:23 2008 +0200
jscript: Added RegExp tests.
---
dlls/jscript/tests/regexp.js | 54 ++++++++++++++++++++++++++++++++++++++++++
dlls/jscript/tests/rsrc.rc | 3 ++
dlls/jscript/tests/run.c | 1 +
3 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/dlls/jscript/tests/regexp.js b/dlls/jscript/tests/regexp.js
new file mode 100644
index 0000000..209ee22
--- /dev/null
+++ b/dlls/jscript/tests/regexp.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+var m;
+
+m = "abcabc".match(/ca/);
+ok(typeof(m) === "object", "typeof m is not object");
+ok(m.length === 1, "m.length is not 1");
+ok(m["0"] === "ca", "m[0] is not \"ca\"");
+
+m = "abcabc".match(/ab/);
+ok(typeof(m) === "object", "typeof m is not object");
+ok(m.length === 1, "m.length is not 1");
+ok(m["0"] === "ab", "m[0] is not \"ab\"");
+
+m = "abcabc".match(/ab/g);
+ok(typeof(m) === "object", "typeof m is not object");
+ok(m.length === 2, "m.length is not 1");
+ok(m["0"] === "ab", "m[0] is not \"ab\"");
+ok(m["1"] === "ab", "m[1] is not \"ab\"");
+
+m = "abcabc".match(/Ab/g);
+ok(typeof(m) === "object", "typeof m is not object");
+ok(m === null, "m is not null");
+
+m = "abcabc".match(/Ab/gi);
+ok(typeof(m) === "object", "typeof m is not object");
+ok(m.length === 2, "m.length is not 1");
+ok(m["0"] === "ab", "m[0] is not \"ab\"");
+ok(m["1"] === "ab", "m[1] is not \"ab\"");
+
+m = "aaabcabc".match(/a+b/g);
+ok(typeof(m) === "object", "typeof m is not object");
+ok(m.length === 2, "m.length is not 1");
+ok(m["0"] === "aaab", "m[0] is not \"ab\"");
+ok(m["1"] === "ab", "m[1] is not \"ab\"");
+
+reportSuccess();
diff --git a/dlls/jscript/tests/rsrc.rc b/dlls/jscript/tests/rsrc.rc
index 407ef2c..ecb4212 100644
--- a/dlls/jscript/tests/rsrc.rc
+++ b/dlls/jscript/tests/rsrc.rc
@@ -21,3 +21,6 @@ api.js 40 "api.js"
/* @makedep: lang.js */
lang.js 40 "lang.js"
+
+/* @makedep: regexp.js */
+regexp.js 40 "regexp.js"
diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c
index e4ecbd7..29947fe 100644
--- a/dlls/jscript/tests/run.c
+++ b/dlls/jscript/tests/run.c
@@ -583,6 +583,7 @@ static void run_tests(void)
run_from_res("lang.js");
run_from_res("api.js");
+ run_from_res("regexp.js");
}
START_TEST(run)
More information about the wine-cvs
mailing list