diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 68a4edf..c2e18b3 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -8555,10 +8555,48 @@ static void test_VarImp(void) SysFreeString(true_str); } +static void test_SomethingStrange(void) +{ + BSTR s1, s2; + int i, j; + + WCHAR szbig[128]; + static const WCHAR W[] = {'W', 0}; + + s1 = SysAllocString(sz12); + i = SysStringLen(s1); + ok(i == 2, "string length should be 2\n"); + SysFreeString(s1); + + memset(szbig, 0, sizeof(szbig)); + for (j = 0; j < sizeof(szbig); j++) lstrcatW(szbig, W); + + for (j = sizeof(szbig); j >= 0; j--) + { + szbig[j] = 0; + s2 = SysAllocString(szbig); + ok(j == SysStringLen(s2), "blah"); + SysFreeString(s2); + i = SysStringLen(s1); + if (j > 5) + { + ok(i == 2, "string length should be 2\n"); + ok(!lstrcmpW(s1, sz12), "blah2"); + } + else + { + ok(i == j, "string length should be %d\n", j); + ok(!lstrcmpW(s1, szbig), "blah3"); + } + } +} + + START_TEST(vartest) { init(); + test_SomethingStrange(); test_VariantInit(); test_VariantClear(); test_VariantCopy(); @@ -8590,5 +8628,5 @@ START_TEST(vartest) test_VarAnd(); test_VarDiv(); test_VarIdiv(); - test_VarImp(); + test_VarImp(); }