https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9187a81538f126dea4e15…
commit 9187a81538f126dea4e15e557d20d92553d074c7
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Sun Dec 24 01:26:29 2017 +0100
[ATL_APITEST] Add a test for CComBSTR.Attach/Detach
---
modules/rostests/apitests/atl/CComBSTR.cpp | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/modules/rostests/apitests/atl/CComBSTR.cpp
b/modules/rostests/apitests/atl/CComBSTR.cpp
index 0a10292c38..e62e76a49c 100644
--- a/modules/rostests/apitests/atl/CComBSTR.cpp
+++ b/modules/rostests/apitests/atl/CComBSTR.cpp
@@ -1,8 +1,8 @@
/*
- * PROJECT: ReactOS api tests
- * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
- * PURPOSE: Test for CComBSTR
- * PROGRAMMER: Mark Jansen
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Test for CComBSTR
+ * COPYRIGHT: Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org)
*/
#include <apitest.h>
@@ -105,6 +105,15 @@ void test_copyassignment()
hr = happy.CopyTo((BSTR*)NULL);
ok(hr == E_POINTER, "Expected hr to be E_POINTER, was: %u\n");
#endif
+
+ BSTR RawPtr = ::SysAllocString(L"TEST--");
+ happy.Attach(RawPtr);
+ ok_ptr(happy.m_str, RawPtr);
+ verify_str(happy, L"TEST--");
+ happyCopy1.Attach(happy.Detach());
+ ok_ptr(happyCopy1.m_str, RawPtr);
+ verify_str(happyCopy1, L"TEST--");
+ ok_ptr(happy.m_str, NULL);
}
void test_fromguid()