Commit 17ceb90b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added String function implementation.

parent 67516448
......@@ -772,7 +772,26 @@ static HRESULT StringConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DIS
{
HRESULT hres;
TRACE("\n");
switch(flags) {
case INVOKE_FUNC: {
BSTR str;
if(arg_cnt(dp)) {
hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &str);
if(FAILED(hres))
return hres;
}else {
str = SysAllocStringLen(NULL, 0);
if(!str)
return E_OUTOFMEMORY;
}
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = str;
break;
}
case DISPATCH_CONSTRUCT: {
DispatchEx *ret;
......
......@@ -69,6 +69,17 @@ ok(str.toString() === "test", "str.toString() = " + str.toString());
tmp = "value " + str;
ok(tmp === "value test", "'value ' + str = " + tmp);
tmp = String();
ok(tmp === "", "String() = " + tmp);
tmp = String(false);
ok(tmp === "false", "String(false) = " + tmp);
tmp = String(null);
ok(tmp === "null", "String(null) = " + tmp);
tmp = String("test");
ok(tmp === "test", "String('test') = " + tmp);
tmp = String("test", "abc");
ok(tmp === "test", "String('test','abc') = " + tmp);
tmp = "abc".charAt(0);
ok(tmp === "a", "'abc',charAt(0) = " + tmp);
tmp = "abc".charAt(1);
......
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