mirror of
				https://github.com/Tencent/rapidjson.git
				synced 2025-10-28 11:31:57 +01:00 
			
		
		
		
	Merge branch 'movetestleak'
This commit is contained in:
		| @@ -348,6 +348,10 @@ TYPED_TEST(DocumentMove, MoveConstructorParseError) { | |||||||
|     EXPECT_EQ(c.GetErrorOffset(), error.Offset()); |     EXPECT_EQ(c.GetErrorOffset(), error.Offset()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // This test does not properly use parsing, just for testing. | ||||||
|  | // It must call ClearStack() explicitly to prevent memory leak. | ||||||
|  | // But here we cannot as ClearStack() is private. | ||||||
|  | #if 0 | ||||||
| TYPED_TEST(DocumentMove, MoveConstructorStack) { | TYPED_TEST(DocumentMove, MoveConstructorStack) { | ||||||
|     typedef TypeParam Allocator; |     typedef TypeParam Allocator; | ||||||
|     typedef UTF8<> Encoding; |     typedef UTF8<> Encoding; | ||||||
| @@ -372,6 +376,7 @@ TYPED_TEST(DocumentMove, MoveConstructorStack) { | |||||||
|     EXPECT_EQ(b.GetStackCapacity(), defaultCapacity); |     EXPECT_EQ(b.GetStackCapacity(), defaultCapacity); | ||||||
|     EXPECT_EQ(c.GetStackCapacity(), capacity); |     EXPECT_EQ(c.GetStackCapacity(), capacity); | ||||||
| } | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
| TYPED_TEST(DocumentMove, MoveAssignment) { | TYPED_TEST(DocumentMove, MoveAssignment) { | ||||||
|     typedef TypeParam Allocator; |     typedef TypeParam Allocator; | ||||||
| @@ -440,6 +445,10 @@ TYPED_TEST(DocumentMove, MoveAssignmentParseError) { | |||||||
|     EXPECT_EQ(c.GetErrorOffset(), error.Offset()); |     EXPECT_EQ(c.GetErrorOffset(), error.Offset()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // This test does not properly use parsing, just for testing. | ||||||
|  | // It must call ClearStack() explicitly to prevent memory leak. | ||||||
|  | // But here we cannot as ClearStack() is private. | ||||||
|  | #if 0 | ||||||
| TYPED_TEST(DocumentMove, MoveAssignmentStack) { | TYPED_TEST(DocumentMove, MoveAssignmentStack) { | ||||||
|     typedef TypeParam Allocator; |     typedef TypeParam Allocator; | ||||||
|     typedef UTF8<> Encoding; |     typedef UTF8<> Encoding; | ||||||
| @@ -466,6 +475,7 @@ TYPED_TEST(DocumentMove, MoveAssignmentStack) { | |||||||
|     EXPECT_EQ(b.GetStackCapacity(), defaultCapacity); |     EXPECT_EQ(b.GetStackCapacity(), defaultCapacity); | ||||||
|     EXPECT_EQ(c.GetStackCapacity(), capacity); |     EXPECT_EQ(c.GetStackCapacity(), capacity); | ||||||
| } | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS | #endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,10 +21,20 @@ | |||||||
| #include "unittest.h" | #include "unittest.h" | ||||||
|  |  | ||||||
| int main(int argc, char **argv) { | int main(int argc, char **argv) { | ||||||
|  |     ::testing::InitGoogleTest(&argc, argv); | ||||||
|  |  | ||||||
| #if _MSC_VER | #if _MSC_VER | ||||||
|     _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); |     _CrtMemState memoryState = { 0 }; | ||||||
|  |     _CrtMemCheckpoint(&memoryState); | ||||||
|  |     //_CrtSetBreakAlloc(X); | ||||||
|     //void *testWhetherMemoryLeakDetectionWorks = malloc(1); |     //void *testWhetherMemoryLeakDetectionWorks = malloc(1); | ||||||
| #endif | #endif | ||||||
|     ::testing::InitGoogleTest(&argc, argv); |  | ||||||
|     return RUN_ALL_TESTS(); |     int ret = RUN_ALL_TESTS(); | ||||||
|  |  | ||||||
|  | #if _MSC_VER | ||||||
|  |     // Current gtest constantly leak 2 blocks at exit | ||||||
|  |     _CrtMemDumpAllObjectsSince(&memoryState); | ||||||
|  | #endif | ||||||
|  |     return ret; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Milo Yip
					Milo Yip