Module: wine Branch: master Commit: 470137b6d36eb87cd4cb4bfc9cd09c9c4642ee5f URL: http://source.winehq.org/git/wine.git/?a=commit;h=470137b6d36eb87cd4cb4bfc9c...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Oct 8 14:38:25 2012 +0200
vbscript: Added CStr implementation.
---
dlls/vbscript/global.c | 12 ++++++++++-- dlls/vbscript/tests/api.vbs | 12 ++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 76a035b..7d60a49 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 47fae0c..ff188ab 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?")