Reactos

[ATL_APITEST] Add a test for CComBSTR.Attach/Detach

+13 -4
+13 -4
modules/rostests/apitests/atl/CComBSTR.cpp
··· 1 1 /* 2 - * PROJECT: ReactOS api tests 3 - * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory 4 - * PURPOSE: Test for CComBSTR 5 - * PROGRAMMER: Mark Jansen 2 + * PROJECT: ReactOS api tests 3 + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 + * PURPOSE: Test for CComBSTR 5 + * COPYRIGHT: Copyright 2015-2017 Mark Jansen (mark.jansen@reactos.org) 6 6 */ 7 7 8 8 #include <apitest.h> ··· 105 105 hr = happy.CopyTo((BSTR*)NULL); 106 106 ok(hr == E_POINTER, "Expected hr to be E_POINTER, was: %u\n"); 107 107 #endif 108 + 109 + BSTR RawPtr = ::SysAllocString(L"TEST--"); 110 + happy.Attach(RawPtr); 111 + ok_ptr(happy.m_str, RawPtr); 112 + verify_str(happy, L"TEST--"); 113 + happyCopy1.Attach(happy.Detach()); 114 + ok_ptr(happyCopy1.m_str, RawPtr); 115 + verify_str(happyCopy1, L"TEST--"); 116 + ok_ptr(happy.m_str, NULL); 108 117 } 109 118 110 119 void test_fromguid()