We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When trying to stringify a boost::filesystem::path, Catch crashes with an infinite recursion:
boost::filesystem::path
#244 0x1001a132b in Catch::StringMaker<boost::filesystem::path, void>::convert(boost::filesystem::path const&) catch.hpp:1074 #245 0x1001a12fb in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::Detail::stringify<boost::filesystem::path>(boost::filesystem::path const&) catch.hpp:772 #246 0x1001a1796 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::Detail::rangeToString<boost::filesystem::path::iterator>(boost::filesystem::path::iterator, boost::filesystem::path::iterator) catch.hpp:927 #247 0x1001a1489 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::rangeToString<boost::filesystem::path>(boost::filesystem::path const&) catch.hpp:1051 #248 0x1001a132b in Catch::StringMaker<boost::filesystem::path, void>::convert(boost::filesystem::path const&) catch.hpp:1074 #249 0x1001a12fb in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::Detail::stringify<boost::filesystem::path>(boost::filesystem::path const&) catch.hpp:772 #250 0x1001a1796 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::Detail::rangeToString<boost::filesystem::path::iterator>(boost::filesystem::path::iterator, boost::filesystem::path::iterator) catch.hpp:927 #251 0x1001a1489 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::rangeToString<boost::filesystem::path>(boost::filesystem::path const&) catch.hpp:1051
The reason is the way iterators for this type works.
Here is a minimal example:
#include <boost/filesystem.hpp> #define CATCH_CONFIG_RUNNER #include <catch/catch.hpp> TEST_CASE("stringify boost::filesystem::path") { CHECK(boost::filesystem::path{"/path1"} == boost::filesystem::path{"/path2"}); } int main(int argc, char* argv[]) { const auto result = Catch::Session().run(argc, argv); return (result < 0xff ? result : 0xff); }
I propose to use operator<< over identifying a type as a range. The StringMaker for ranges would look like this:
operator<<
StringMaker
template<typename R> struct StringMaker<R, typename std::enable_if<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>::type> { static std::string convert( R const& range ) { return rangeToString( range ); } };
This removes the special case for string ranges and fixes this bug as well.
The text was updated successfully, but these errors were encountered:
I've already run into the same issue with json iterators, but didn't have time to fix it at the time.
Agree that the order should go StringMaker, operator<< and then fallback detections (enums, ranges etc).
Sorry, something went wrong.
126850e
That was a really quick response, thanks!
No branches or pull requests
Description
When trying to stringify a
boost::filesystem::path
, Catch crashes with an infinite recursion:The reason is the way iterators for this type works.
Steps to reproduce
Here is a minimal example:
Extra information
Proposal
I propose to use
operator<<
over identifying a type as a range. TheStringMaker
for ranges would look like this:This removes the special case for string ranges and fixes this bug as well.
The text was updated successfully, but these errors were encountered: