jscript: Implement the String.sub() method.

This commit is contained in:
Andrew Nguyen 2008-12-10 03:07:35 -06:00 committed by Alexandre Julliard
parent f2388d9269
commit 257e15da39
2 changed files with 11 additions and 2 deletions

View File

@ -1004,8 +1004,8 @@ static HRESULT String_strike(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
static HRESULT String_sub(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
static const WCHAR subtagW[] = {'S','U','B',0};
return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, subtagW);
}
/* ECMA-262 3rd Edition 15.5.4.15 */

View File

@ -332,6 +332,15 @@ ok(tmp === "<STRIKE>test</STRIKE>", "'test'.strike() = " + tmp);
tmp = "test".strike(3);
ok(tmp === "<STRIKE>test</STRIKE>", "'test'.strike(3) = " + tmp);
tmp = "".sub();
ok(tmp === "<SUB></SUB>", "''.sub() = " + tmp);
tmp = "".sub(3);
ok(tmp === "<SUB></SUB>", "''.sub(3) = " + tmp);
tmp = "test".sub();
ok(tmp === "<SUB>test</SUB>", "'test'.sub() = " + tmp);
tmp = "test".sub(3);
ok(tmp === "<SUB>test</SUB>", "'test'.sub(3) = " + tmp);
var arr = new Array();
ok(typeof(arr) === "object", "arr () is not object");
ok((arr.length === 0), "arr.length is not 0");