diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 76a035b6a5..7d60a497a3 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -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) diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 47fae0cd9d..ff188ab051 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -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?")