Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boost_test_print_type is not considered when printing out values with non-explicit operator bools #159

Closed
Marc-Aldorasi-Imprivata opened this issue Sep 11, 2018 · 3 comments

Comments

@Marc-Aldorasi-Imprivata
struct s
{
	operator bool() const { return false; }
};
std::ostream &boost_test_print_type(std::ostream &o, const s &) { return o << "s"; }

struct s2
{
	operator bool() const { return false; }
};
std::ostream &operator<<(std::ostream &o, const s2 &) { return o << "s2"; }

BOOST_AUTO_TEST_CASE(f)
{
	BOOST_TEST(s{});
	BOOST_TEST(s2{});
}

When printing out the failures in this test, the second check correctly uses operator<< to print out the value of s2, but the first check displays the value of s as 0. s should be printed out using boost_test_print_type instead.

@raffienficiaud
Copy link
Member

Would you please check the branch topic/GH-158-boost_test_print_type-printing-on-single-value? It should solve this issue and the other you mentioned #158 .

@Marc-Aldorasi-Imprivata
Copy link
Author

That fixes both issues, thanks.

@raffienficiaud
Copy link
Member

Merged to develop, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants