From 1388a6f421162736814d627c5d829405d72c8f46 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sun, 21 Sep 2008 15:41:42 +0200 Subject: [PATCH] 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 657aa67cd21..60829aba12f 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 0db84b1dd5a..9efe8560f9d 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);