jscript: Added RegExp.test implementation.
This commit is contained in:
parent
132009469c
commit
39521de784
|
@ -3646,8 +3646,21 @@ static HRESULT RegExp_exec(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
|
||||||
static HRESULT RegExp_test(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
static HRESULT RegExp_test(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||||
{
|
{
|
||||||
FIXME("\n");
|
match_result_t match;
|
||||||
return E_NOTIMPL;
|
VARIANT_BOOL b;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("\n");
|
||||||
|
|
||||||
|
hres = run_exec(dispex, arg_cnt(dp) ? get_arg(dp,0) : NULL, lcid, ei, NULL, &match, NULL, NULL, &b);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
if(retv) {
|
||||||
|
V_VT(retv) = VT_BOOL;
|
||||||
|
V_BOOL(retv) = b;
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT RegExp_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
static HRESULT RegExp_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||||
|
|
|
@ -71,6 +71,26 @@ m = re.exec();
|
||||||
ok(m === null, "m is not null");
|
ok(m === null, "m is not null");
|
||||||
ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex);
|
ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex);
|
||||||
|
|
||||||
|
b = re.test(" a ");
|
||||||
|
ok(b === true, "re.test(' a ') returned " + b);
|
||||||
|
ok(re.lastIndex === 3, "re.lastIndex = " + re.lastIndex);
|
||||||
|
|
||||||
|
b = re.test(" a ");
|
||||||
|
ok(b === false, "re.test(' a ') returned " + b);
|
||||||
|
ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex);
|
||||||
|
|
||||||
|
re = /\[([^\[]+)\]/g;
|
||||||
|
m = re.exec(" [test] ");
|
||||||
|
ok(re.lastIndex === 7, "re.lastIndex = " + re.lastIndex);
|
||||||
|
ok(m.index === 1, "m.index = " + m.index);
|
||||||
|
ok(m.input === " [test] ", "m.input = " + m.input);
|
||||||
|
ok(m.length === 2, "m.length = " + m.length);
|
||||||
|
ok(m[0] === "[test]", "m[0] = " + m[0]);
|
||||||
|
ok(m[1] === "test", "m[1] = " + m[1]);
|
||||||
|
|
||||||
|
b = /a*/.test();
|
||||||
|
ok(b === true, "/a*/.test() returned " + b);
|
||||||
|
|
||||||
m = "abcabc".match(/ca/);
|
m = "abcabc".match(/ca/);
|
||||||
ok(typeof(m) === "object", "typeof m is not object");
|
ok(typeof(m) === "object", "typeof m is not object");
|
||||||
ok(m.length === 1, "m.length is not 1");
|
ok(m.length === 1, "m.length is not 1");
|
||||||
|
|
Loading…
Reference in New Issue