Module: wine Branch: master Commit: 91ce0dd6a33edf148bb01675873158df1577caa4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=91ce0dd6a33edf148bb0167587...
Author: Piotr Caban piotr.caban@gmail.com Date: Sun Jul 12 19:52:21 2009 +0200
jscript: Fix String_match implementation.
---
dlls/jscript/string.c | 9 ++++++--- dlls/jscript/tests/regexp.js | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 0385a22..6aa6302 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -596,9 +596,12 @@ static HRESULT String_match(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
TRACE("\n");
- if(arg_cnt(dp) != 1) { - FIXME("unsupported args\n"); - return E_NOTIMPL; + if(!arg_cnt(dp)) { + if(retv) { + V_VT(retv) = VT_NULL; + } + + return S_OK; }
arg_var = get_arg(dp, 0); diff --git a/dlls/jscript/tests/regexp.js b/dlls/jscript/tests/regexp.js index 6809101..3e4db68 100644 --- a/dlls/jscript/tests/regexp.js +++ b/dlls/jscript/tests/regexp.js @@ -31,7 +31,7 @@ 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.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not "ab""); ok(m["1"] === "ab", "m[1] is not "ab"");
@@ -41,7 +41,7 @@ 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.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not "ab""); ok(m["1"] === "ab", "m[1] is not "ab"");
@@ -64,22 +64,30 @@ ok(m["0"] === "ab", "m[0] is not "ab"");
m = "abcabc".match(new RegExp("ab","g")); ok(typeof(m) === "object", "typeof m is not object"); -ok(m.length === 2, "m.length is not 1"); +ok(m.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not "ab""); ok(m["1"] === "ab", "m[1] is not "ab"");
m = "abcabc".match(new RegExp(/ab/g)); ok(typeof(m) === "object", "typeof m is not object"); -ok(m.length === 2, "m.length is not 1"); +ok(m.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not "ab""); ok(m["1"] === "ab", "m[1] is not "ab"");
m = "abcabc".match(new RegExp("ab","g", "test")); ok(typeof(m) === "object", "typeof m is not object"); -ok(m.length === 2, "m.length is not 1"); +ok(m.length === 2, "m.length is not 2"); ok(m["0"] === "ab", "m[0] is not "ab""); ok(m["1"] === "ab", "m[1] is not "ab"");
+m = "abcabcg".match("ab", "g"); +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(); +ok(m === null, "m is not null"); + r = "- [test] -".replace(/[([^[]+)]/g, "success"); ok(r === "- success -", "r = " + r + " expected '- success -'");