Print std type #4121
-
Hi! Is there any way to provide custom printing function for std types e.g. std::future_status on version 1.11? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In version 1.11 of Google Test, custom printing functions for standard types such as std::future_status can be implemented by creating a specialization of the ::testing::internal::UniversalPrinter template class for the specific type in question. Here is an example of how you might define a custom printing function for std::future_status:
You should put this code in a .cc file in your test project, and include it in your test targets. This will allow you to use the EXPECT_EQ and ASSERT_EQ macros with std::future_status values and have the custom printing function used when the test fails and the values are printed. It's worth noting that in later versions of GoogleTest, this functionality is provided by TEST_P macro. |
Beta Was this translation helpful? Give feedback.
In version 1.11 of Google Test, custom printing functions for standard types such as std::future_status can be implemented by creating a specialization of the ::testing::internal::UniversalPrinter template class for the specific type in question.
Here is an example of how you might define a custom printing function for std::future_status: