forked from Alepha/Alepha
Table tests now print argument information about failed cases.
At least they'll print as much information as they can. Unstreamable input types will just print typeid information.
This commit is contained in:
@ -165,8 +165,9 @@ namespace Alepha::Hydrogen::Testing ::detail:: TableTest_m
|
||||
}
|
||||
{}
|
||||
|
||||
template< typename ... Params >
|
||||
std::tuple< TestResult, std::optional< std::string > >
|
||||
operator() ( Invoker invoker, const std::string &comment ) const
|
||||
operator() ( Invoker invoker, const std::string &comment, const std::tuple< Params... > params ) const
|
||||
{
|
||||
if( impl != nullptr ) return impl( invoker, comment );
|
||||
if constexpr( std::is_base_of_v< std::decay_t< return_type >, ComputedBase > )
|
||||
@ -202,6 +203,14 @@ namespace Alepha::Hydrogen::Testing ::detail:: TableTest_m
|
||||
streamDebugging< outputMode >( oss, std::get< return_type >( witness ), expected );
|
||||
}
|
||||
else oss << "Unexpected exception of type: " << std::get< ErrorMessage >( witness ).mesg;
|
||||
|
||||
oss << std::endl << "Test inputs were: " << std::endl;
|
||||
int index= 0;
|
||||
tuple_for_each( params ) <=[&]( const auto ¶m )
|
||||
{
|
||||
// Debugging output for test inputs is relaxed, as it's not required they be streamable?
|
||||
oss << "Argument " << index++ << ": " << streamAdaptValue< OutputMode::Relaxed >( param ) << std::endl;
|
||||
};
|
||||
}
|
||||
return { result, oss.str().empty() ? std::optional< std::string >{} : std::move( oss ).str() };
|
||||
}
|
||||
@ -472,7 +481,7 @@ namespace Alepha::Hydrogen::Testing ::detail:: TableTest_m
|
||||
};
|
||||
const auto checker= [=]( const auto comment )
|
||||
{
|
||||
return handler( invoker, comment );
|
||||
return handler( invoker, comment, params );
|
||||
};
|
||||
if( comment.state == CaseComment::Enabled )
|
||||
{
|
||||
|
Reference in New Issue
Block a user