From 257e15da39c34870cd13f3b7852246fd1a95f44f Mon Sep 17 00:00:00 2001 From: Andrew Nguyen Date: Wed, 10 Dec 2008 03:07:35 -0600 Subject: [PATCH] jscript: Implement the String.sub() method. --- dlls/jscript/string.c | 4 ++-- dlls/jscript/tests/api.js | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 6dff58ecf17..c0ee3115d99 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -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 */ diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 1a0a88d213f..72b64d26cae 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -332,6 +332,15 @@ ok(tmp === "test", "'test'.strike() = " + tmp); tmp = "test".strike(3); ok(tmp === "test", "'test'.strike(3) = " + tmp); +tmp = "".sub(); +ok(tmp === "", "''.sub() = " + tmp); +tmp = "".sub(3); +ok(tmp === "", "''.sub(3) = " + tmp); +tmp = "test".sub(); +ok(tmp === "test", "'test'.sub() = " + tmp); +tmp = "test".sub(3); +ok(tmp === "test", "'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"); -- 2.11.4.GIT