vbscript: Added CStr implementation.

This commit is contained in:
Jacek Caban 2012-10-08 14:38:25 +02:00 committed by Alexandre Julliard
parent c046d30fb7
commit 470137b6d3
2 changed files with 22 additions and 2 deletions

View File

@ -402,8 +402,16 @@ static HRESULT Global_CSng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
static HRESULT Global_CStr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
BSTR str;
HRESULT hres;
TRACE("%s\n", debugstr_variant(arg));
hres = to_string(arg, &str);
if(FAILED(hres))
return hres;
return return_bstr(res, str);
}
static inline WCHAR hex_char(unsigned n)

View File

@ -38,6 +38,18 @@ Call ok(getVT(vbFriday) = "VT_I2", "getVT(vbFriday) = " & getVT(vbFriday))
Call ok(vbSaturday = 7, "vbSaturday = " & vbSaturday)
Call ok(getVT(vbSaturday) = "VT_I2", "getVT(vbSaturday) = " & getVT(vbSaturday))
Sub TestCStr(arg, exval)
dim x
x = CStr(arg)
Call ok(getVT(x) = "VT_BSTR*", "getVT(x) = " & getVT(x))
Call ok(x = exval, "CStr(" & arg & ") = " & x)
End Sub
TestCStr "test", "test"
TestCStr 3, "3"
TestCStr 3.5, "3.5"
if isEnglishLang then TestCStr true, "True"
Call ok(isObject(new EmptyClass), "isObject(new EmptyClass) is not true?")
Set x = new EmptyClass
Call ok(isObject(x), "isObject(x) is not true?")