Commit c4148203 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

jscript: Implement the String.toLowerCase() method.

parent e83b62f3
...@@ -1069,8 +1069,34 @@ static HRESULT String_sup(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS ...@@ -1069,8 +1069,34 @@ static HRESULT String_sup(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
static HRESULT String_toLowerCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, static HRESULT String_toLowerCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
FIXME("\n"); StringInstance *string;
return E_NOTIMPL; const WCHAR* str;
DWORD length;
BSTR bstr;
TRACE("\n");
if(is_class(dispex, JSCLASS_STRING)) {
string = (StringInstance*)dispex;
length = string->length;
str = string->str;
}else {
FIXME("not string this not supported\n");
return E_NOTIMPL;
}
if(retv) {
bstr = SysAllocStringLen(str, length);
if (!bstr)
return E_OUTOFMEMORY;
strlwrW(bstr);
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = bstr;
}
return S_OK;
} }
static HRESULT String_toUpperCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, static HRESULT String_toUpperCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
......
...@@ -247,6 +247,17 @@ ok(tmp === 1, "indexOf = " + tmp); ...@@ -247,6 +247,17 @@ ok(tmp === 1, "indexOf = " + tmp);
tmp = "abcd".indexOf(); tmp = "abcd".indexOf();
ok(tmp == -1, "indexOf = " + tmp); ok(tmp == -1, "indexOf = " + tmp);
tmp = "".toLowerCase();
ok(tmp === "", "''.toLowerCase() = " + tmp);
tmp = "test".toLowerCase();
ok(tmp === "test", "''.toLowerCase() = " + tmp);
tmp = "test".toLowerCase(3);
ok(tmp === "test", "''.toLowerCase(3) = " + tmp);
tmp = "tEsT".toLowerCase();
ok(tmp === "test", "''.toLowerCase() = " + tmp);
tmp = "tEsT".toLowerCase(3);
ok(tmp === "test", "''.toLowerCase(3) = " + tmp);
var arr = new Array(); var arr = new Array();
ok(typeof(arr) === "object", "arr () is not object"); ok(typeof(arr) === "object", "arr () is not object");
ok((arr.length === 0), "arr.length is not 0"); ok((arr.length === 0), "arr.length is not 0");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment