jscript: Implement the String.sub() method.
authorAndrew Nguyen <arethusa26@gmail.com>
Wed, 10 Dec 2008 09:07:35 +0000 (03:07 -0600)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 10 Dec 2008 10:50:18 +0000 (11:50 +0100)
dlls/jscript/string.c
dlls/jscript/tests/api.js

index 6dff58ecf175cb92ceb27abdf47aeb40c185bda9..c0ee3115d99bd6496d5c13ad9bd744965b8e7205 100644 (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 */
index 1a0a88d213f840303863fac59dae118ba3ff0b5c..72b64d26cae4dcd8010b193c2a9e2af15cc52a5d 100644 (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");