Jacek Caban : jscript: Added String function implementation.
Alexandre Julliard
julliard at winehq.org
Mon Sep 22 07:04:30 CDT 2008
Module: wine
Branch: master
Commit: 17ceb90b30f14fba20c8205870f2a2f89f7a1e6b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=17ceb90b30f14fba20c8205870f2a2f89f7a1e6b
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun Sep 21 15:44:29 2008 +0200
jscript: Added String function implementation.
---
dlls/jscript/string.c | 19 +++++++++++++++++++
dlls/jscript/tests/api.js | 11 +++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c
index 9da1bfb..d4f58cd 100644
--- a/dlls/jscript/string.c
+++ b/dlls/jscript/string.c
@@ -772,7 +772,26 @@ static HRESULT StringConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DIS
{
HRESULT hres;
+ TRACE("\n");
+
switch(flags) {
+ case INVOKE_FUNC: {
+ BSTR str;
+
+ if(arg_cnt(dp)) {
+ hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &str);
+ if(FAILED(hres))
+ return hres;
+ }else {
+ str = SysAllocStringLen(NULL, 0);
+ if(!str)
+ return E_OUTOFMEMORY;
+ }
+
+ V_VT(retv) = VT_BSTR;
+ V_BSTR(retv) = str;
+ break;
+ }
case DISPATCH_CONSTRUCT: {
DispatchEx *ret;
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index cea936d..04515e3 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -69,6 +69,17 @@ ok(str.toString() === "test", "str.toString() = " + str.toString());
tmp = "value " + str;
ok(tmp === "value test", "'value ' + str = " + tmp);
+tmp = String();
+ok(tmp === "", "String() = " + tmp);
+tmp = String(false);
+ok(tmp === "false", "String(false) = " + tmp);
+tmp = String(null);
+ok(tmp === "null", "String(null) = " + tmp);
+tmp = String("test");
+ok(tmp === "test", "String('test') = " + tmp);
+tmp = String("test", "abc");
+ok(tmp === "test", "String('test','abc') = " + tmp);
+
tmp = "abc".charAt(0);
ok(tmp === "a", "'abc',charAt(0) = " + tmp);
tmp = "abc".charAt(1);
More information about the wine-cvs
mailing list