Jacek Caban : jscript: Added String.valueOf implementation.

Alexandre Julliard julliard at winehq.org
Mon Sep 22 07:04:17 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Sep 21 15:41:42 2008 +0200

jscript: Added String.valueOf implementation.

---

 dlls/jscript/string.c     |    6 ++++--
 dlls/jscript/tests/api.js |    7 +++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c
index 657aa67..60829ab 100644
--- a/dlls/jscript/string.c
+++ b/dlls/jscript/string.c
@@ -114,11 +114,13 @@ static HRESULT String_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
     return S_OK;
 }
 
+/* ECMA-262 3rd Edition    15.5.4.2 */
 static HRESULT String_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
         VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    TRACE("\n");
+
+    return String_toString(dispex, lcid, flags, dp, retv, ei, sp);
 }
 
 static HRESULT String_anchor(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index 0db84b1..9efe856 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -33,6 +33,13 @@ ok(tmp === "test", "''.toString() = " + tmp);
 tmp = "test".toString(3);
 ok(tmp === "test", "''.toString(3) = " + tmp);
 
+tmp = "".valueOf();
+ok(tmp === "", "''.valueOf() = " + tmp);
+tmp = "test".valueOf();
+ok(tmp === "test", "''.valueOf() = " + tmp);
+tmp = "test".valueOf(3);
+ok(tmp === "test", "''.valueOf(3) = " + tmp);
+
 tmp = "abc".charAt(0);
 ok(tmp === "a", "'abc',charAt(0) = " + tmp);
 tmp = "abc".charAt(1);




More information about the wine-cvs mailing list