mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
jscript: Added String function implementation.
This commit is contained in:
parent
6751644835
commit
17ceb90b30
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user