vbscript: Added LCase implementation.
This commit is contained in:
parent
0708b77b9b
commit
a1428c78b0
|
@ -582,8 +582,33 @@ static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, V
|
||||||
|
|
||||||
static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||||
{
|
{
|
||||||
FIXME("\n");
|
BSTR str;
|
||||||
return E_NOTIMPL;
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("%s\n", debugstr_variant(arg));
|
||||||
|
|
||||||
|
if(V_VT(arg) == VT_NULL) {
|
||||||
|
if(res)
|
||||||
|
V_VT(res) = VT_NULL;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = to_string(arg, &str);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
if(res) {
|
||||||
|
WCHAR *ptr;
|
||||||
|
|
||||||
|
for(ptr = str; *ptr; ptr++)
|
||||||
|
*ptr = tolowerW(*ptr);
|
||||||
|
|
||||||
|
V_VT(res) = VT_BSTR;
|
||||||
|
V_BSTR(res) = str;
|
||||||
|
}else {
|
||||||
|
SysFreeString(str);
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||||
|
|
|
@ -159,4 +159,18 @@ TestUCase 0.123, "0.123"
|
||||||
TestUCase Empty, ""
|
TestUCase Empty, ""
|
||||||
Call ok(getVT(UCase(Null)) = "VT_NULL", "getVT(UCase(Null)) = " & getVT(UCase(Null)))
|
Call ok(getVT(UCase(Null)) = "VT_NULL", "getVT(UCase(Null)) = " & getVT(UCase(Null)))
|
||||||
|
|
||||||
|
Sub TestLCase(str, ex)
|
||||||
|
x = LCase(str)
|
||||||
|
Call ok(x = ex, "LCase(" & str & ") = " & x & " expected " & ex)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
TestLCase "test", "test"
|
||||||
|
TestLCase "123aBC?", "123abc?"
|
||||||
|
TestLCase "", ""
|
||||||
|
TestLCase 1, "1"
|
||||||
|
TestLCase true, "true"
|
||||||
|
TestLCase 0.123, "0.123"
|
||||||
|
TestLCase Empty, ""
|
||||||
|
Call ok(getVT(LCase(Null)) = "VT_NULL", "getVT(LCase(Null)) = " & getVT(LCase(Null)))
|
||||||
|
|
||||||
Call reportSuccess()
|
Call reportSuccess()
|
||||||
|
|
Loading…
Reference in New Issue