martinmoene / lest

A modern, C++11-native, single-file header-only, tiny framework for unit-tests, TDD and BDD (includes C++98 variant)
Boost Software License 1.0
390 stars 45 forks source link

Clamp program exit value to 255 #60

Closed martinmoene closed 6 years ago

martinmoene commented 6 years ago

See Catch issue 1215: Catch Reports Exit Code 0 Even with Failed Tests

Change:

return for_test( specification, in, confirm( os, option ), option.repeat );

to:

auto const MaxExitCode = 255;
return (std::min)( for_test( specification, in, confirm( os, option ), option.repeat ), MaxExitCode );