jscript: Added String.length implementation.
This commit is contained in:
parent
c137281469
commit
b48489be3c
|
@ -70,10 +70,24 @@ static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','
|
|||
static HRESULT String_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
TRACE("%p\n", dispex);
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_PROPERTYGET: {
|
||||
StringInstance *jsthis = (StringInstance*)dispex;
|
||||
|
||||
V_VT(retv) = VT_I4;
|
||||
V_I4(retv) = jsthis->length;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FIXME("unimplemented flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT String_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
ok("".length === 0, "\"\".length = " + "".length);
|
||||
ok(getVT("".length) == "VT_I4", "\"\".length = " + "".length);
|
||||
ok("abc".length === 3, "\"abc\".length = " + "abc".length);
|
||||
ok(String.prototype.length === 0, "String.prototype.length = " + String.prototype.length);
|
||||
|
||||
var arr = new Array();
|
||||
ok(typeof(arr) === "object", "arr () is not object");
|
||||
ok((arr.length === 0), "arr.length is not 0");
|
||||
|
|
Loading…
Reference in New Issue