Andrew Nguyen : jscript: Implement the String.sub() method.

Alexandre Julliard julliard at winehq.org
Wed Dec 10 07:41:57 CST 2008


Module: wine
Branch: master
Commit: 257e15da39c34870cd13f3b7852246fd1a95f44f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=257e15da39c34870cd13f3b7852246fd1a95f44f

Author: Andrew Nguyen <arethusa26 at gmail.com>
Date:   Wed Dec 10 03:07:35 2008 -0600

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 6dff58e..c0ee311 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 1a0a88d..72b64d2 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -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");




More information about the wine-cvs mailing list