vbscript: Added concatenation tests.

This commit is contained in:
Jacek Caban 2011-09-12 12:31:07 +02:00 committed by Alexandre Julliard
parent fad15f782a
commit a5fe24c61d
2 changed files with 42 additions and 0 deletions

View File

@ -52,5 +52,16 @@ Call ok(getVT(&h10&) = "VT_I2", "getVT(&h10&) is not VT_I2")
Call ok(getVT(&h10000&) = "VT_I4", "getVT(&h10000&) is not VT_I4")
Call ok(getVT(&H10000&) = "VT_I4", "getVT(&H10000&) is not VT_I4")
Call ok(getVT(&hffFFffFF&) = "VT_I2", "getVT(&hffFFffFF&) is not VT_I2")
Call ok(getVT(1 & 100000) = "VT_BSTR", "getVT(1 & 100000) is not VT_BSTR")
Call ok("ab" & "cd" = "abcd", """ab"" & ""cd"" <> ""abcd""")
Call ok("ab " & null = "ab ", """ab"" & null = " & ("ab " & null))
Call ok("ab " & empty = "ab ", """ab"" & empty = " & ("ab " & empty))
Call ok(1 & 100000 = "1100000", "1 & 100000 = " & (1 & 100000))
'if(isEnglishLocale) then
' Call ok("" & true = "True", """"" & true = " & true)
' Call ok(true & false = "TrueFalse", "true & false = " & (true & false))
'end if
reportSuccess()

View File

@ -63,6 +63,7 @@ DEFINE_EXPECT(global_success_i);
#define DISPID_GLOBAL_TRACE 1001
#define DISPID_GLOBAL_OK 1002
#define DISPID_GLOBAL_GETVT 1003
#define DISPID_GLOBAL_ISENGLOC 1004
static const WCHAR testW[] = {'t','e','s','t',0};
@ -121,6 +122,12 @@ static const char *vt2a(VARIANT *v)
}
}
static BOOL is_english(void)
{
return PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH
&& PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
}
#define test_grfdex(a,b) _test_grfdex(__LINE__,a,b)
static void _test_grfdex(unsigned line, DWORD grfdex, DWORD expect)
{
@ -240,6 +247,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
*pid = DISPID_GLOBAL_GETVT;
return S_OK;
}
if(!strcmp_wa(bstrName, "isEnglishLocale")) {
test_grfdex(grfdex, fdexNameCaseInsensitive);
*pid = DISPID_GLOBAL_ISENGLOC;
return S_OK;
}
if(strict_dispid_check && strcmp_wa(bstrName, "x"))
ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
@ -319,6 +331,25 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
V_VT(pvarRes) = VT_BSTR;
V_BSTR(pvarRes) = a2bstr(vt2a(pdp->rgvarg));
return S_OK;
case DISPID_GLOBAL_ISENGLOC:
ok(wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
ok(pdp->cArgs == 0, "cArgs = %d\n", pdp->cArgs);
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
ok(pvarRes != NULL, "pvarRes == NULL\n");
ok(pei != NULL, "pei == NULL\n");
V_VT(pvarRes) = VT_BOOL;
if(is_english()) {
V_BOOL(pvarRes) = VARIANT_TRUE;
}else {
skip("Skipping some test in non-English locale\n");
V_BOOL(pvarRes) = VARIANT_FALSE;
}
return S_OK;
}
ok(0, "unexpected call %d\n", id);