mirror of https://github.com/catchorg/Catch2.git
--min-duration is overriden by -d no
This commit is contained in:
parent
4eb9d37e05
commit
6f7c191513
|
@ -42,9 +42,13 @@ namespace Catch {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldShowDuration( IConfig const& config, double duration ) {
|
bool shouldShowDuration( IConfig const& config, double duration ) {
|
||||||
if( config.showDurations() == ShowDurations::Always )
|
if ( config.showDurations() == ShowDurations::Always ) {
|
||||||
return true;
|
return true;
|
||||||
double min = config.minDuration();
|
}
|
||||||
|
if ( config.showDurations() == ShowDurations::Never ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const double min = config.minDuration();
|
||||||
return min >= 0 && duration >= min;
|
return min >= 0 && duration >= min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ namespace Catch {
|
||||||
// Returns double formatted as %.3f (format expected on output)
|
// Returns double formatted as %.3f (format expected on output)
|
||||||
std::string getFormattedDuration( double duration );
|
std::string getFormattedDuration( double duration );
|
||||||
|
|
||||||
bool shouldShowDuration( IConfig const &, double duration );
|
//! Should the reporter show
|
||||||
|
bool shouldShowDuration( IConfig const& config, double duration );
|
||||||
|
|
||||||
std::string serializeFilters( std::vector<std::string> const& container );
|
std::string serializeFilters( std::vector<std::string> const& container );
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,15 @@ set_tests_properties(
|
||||||
PASS_REGULAR_EXPRESSION "s: sleep_for_100ms"
|
PASS_REGULAR_EXPRESSION "s: sleep_for_100ms"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# -d no overrides the threshold, so we should never see any tests even
|
||||||
|
# with ridiculously low min duration threshold
|
||||||
|
add_test(NAME MinDuration::DurationOverrideNo COMMAND $<TARGET_FILE:SelfTest> --min-duration 0.0001 -d no [min_duration_test])
|
||||||
|
set_tests_properties(
|
||||||
|
MinDuration::DurationOverrideNo
|
||||||
|
PROPERTIES
|
||||||
|
FAIL_REGULAR_EXPRESSION "sleep_for_200ms"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# ------------ end of duration reporting tests
|
# ------------ end of duration reporting tests
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue