Commit 91ce0dd6 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

jscript: Fix String_match implementation.

parent df819566
...@@ -596,9 +596,12 @@ static HRESULT String_match(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM ...@@ -596,9 +596,12 @@ static HRESULT String_match(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
TRACE("\n"); TRACE("\n");
if(arg_cnt(dp) != 1) { if(!arg_cnt(dp)) {
FIXME("unsupported args\n"); if(retv) {
return E_NOTIMPL; V_VT(retv) = VT_NULL;
}
return S_OK;
} }
arg_var = get_arg(dp, 0); arg_var = get_arg(dp, 0);
......
...@@ -31,7 +31,7 @@ ok(m["0"] === "ab", "m[0] is not \"ab\""); ...@@ -31,7 +31,7 @@ ok(m["0"] === "ab", "m[0] is not \"ab\"");
m = "abcabc".match(/ab/g); m = "abcabc".match(/ab/g);
ok(typeof(m) === "object", "typeof m is not object"); 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["0"] === "ab", "m[0] is not \"ab\"");
ok(m["1"] === "ab", "m[1] is not \"ab\""); ok(m["1"] === "ab", "m[1] is not \"ab\"");
...@@ -41,7 +41,7 @@ ok(m === null, "m is not null"); ...@@ -41,7 +41,7 @@ ok(m === null, "m is not null");
m = "abcabc".match(/Ab/gi); m = "abcabc".match(/Ab/gi);
ok(typeof(m) === "object", "typeof m is not object"); 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["0"] === "ab", "m[0] is not \"ab\"");
ok(m["1"] === "ab", "m[1] 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\""); ...@@ -64,22 +64,30 @@ ok(m["0"] === "ab", "m[0] is not \"ab\"");
m = "abcabc".match(new RegExp("ab","g")); m = "abcabc".match(new RegExp("ab","g"));
ok(typeof(m) === "object", "typeof m is not object"); 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["0"] === "ab", "m[0] is not \"ab\"");
ok(m["1"] === "ab", "m[1] is not \"ab\""); ok(m["1"] === "ab", "m[1] is not \"ab\"");
m = "abcabc".match(new RegExp(/ab/g)); m = "abcabc".match(new RegExp(/ab/g));
ok(typeof(m) === "object", "typeof m is not object"); 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["0"] === "ab", "m[0] is not \"ab\"");
ok(m["1"] === "ab", "m[1] is not \"ab\""); ok(m["1"] === "ab", "m[1] is not \"ab\"");
m = "abcabc".match(new RegExp("ab","g", "test")); m = "abcabc".match(new RegExp("ab","g", "test"));
ok(typeof(m) === "object", "typeof m is not object"); 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["0"] === "ab", "m[0] is not \"ab\"");
ok(m["1"] === "ab", "m[1] 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"); r = "- [test] -".replace(/\[([^\[]+)\]/g, "success");
ok(r === "- success -", "r = " + r + " expected '- success -'"); ok(r === "- success -", "r = " + r + " expected '- success -'");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment