Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 8, 2024
1 parent e8ea7d6 commit 7083151
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 53 deletions.
43 changes: 21 additions & 22 deletions tests/cpp/catch2/catch_amalgamated.cpp
Expand Up @@ -549,12 +549,13 @@ Config::Config(ConfigData const &data) : m_data(data) {
if (m_data.reporterSpecifications.empty()) {
m_data.reporterSpecifications.push_back({
#if defined(CATCH_CONFIG_DEFAULT_REPORTER)
CATCH_CONFIG_DEFAULT_REPORTER,
CATCH_CONFIG_DEFAULT_REPORTER,
#else
"console",
"console",
#endif
{}, {}, {}
});
{},
{},
{}});
}

#if !defined(CATCH_PLATFORM_WINDOWS_UWP)
Expand Down Expand Up @@ -1035,12 +1036,11 @@ void Session::showHelp() const {
<< std::flush;
}
void Session::libIdentify() {
Catch::cout() << std::left << std::setw(16) << "description: "
<< "A Catch2 test executable\n"
<< std::left << std::setw(16) << "category: "
<< "testframework\n"
<< std::left << std::setw(16) << "framework: "
<< "Catch2\n"
Catch::cout() << std::left << std::setw(16)
<< "description: " << "A Catch2 test executable\n"
<< std::left << std::setw(16)
<< "category: " << "testframework\n"
<< std::left << std::setw(16) << "framework: " << "Catch2\n"
<< std::left << std::setw(16) << "version: " << libraryVersion()
<< '\n'
<< std::flush;
Expand Down Expand Up @@ -3884,8 +3884,8 @@ auto makeStream(std::string const &filename) -> Detail::unique_ptr<IStream> {

namespace Catch {

auto operator<<(std::ostream &os, LazyExpression const &lazyExpr)
-> std::ostream & {
auto operator<<(std::ostream &os,
LazyExpression const &lazyExpr) -> std::ostream & {
if (lazyExpr.m_isNegated)
os << '!';

Expand Down Expand Up @@ -7830,8 +7830,8 @@ class Duration {
return "** internal error **"_sr;
}
}
friend auto operator<<(std::ostream &os, Duration const &duration)
-> std::ostream & {
friend auto operator<<(std::ostream &os,
Duration const &duration) -> std::ostream & {
return os << duration.value() << ' ' << duration.unitsAsString();
}
};
Expand Down Expand Up @@ -8918,8 +8918,7 @@ void JunitReporter::writeAssertion(AssertionStats const &stats) {

ReusableStringStream rss;
if (stats.totals.assertions.total() > 0) {
rss << "FAILED"
<< ":\n";
rss << "FAILED" << ":\n";
if (result.hasExpression()) {
rss << " ";
rss << result.getExpressionInMacro();
Expand Down Expand Up @@ -9612,13 +9611,13 @@ void TeamCityReporter::assertionEnded(AssertionStats const &assertionStats) {

if (currentTestCaseInfo->okToFail()) {
msg << "- failure ignore as test marked as 'ok to fail'\n";
m_stream << "##teamcity[testIgnored"
<< " name='" << escape(currentTestCaseInfo->name) << '\''
<< " message='" << escape(msg.str()) << '\'' << "]\n";
m_stream << "##teamcity[testIgnored" << " name='"
<< escape(currentTestCaseInfo->name) << '\'' << " message='"
<< escape(msg.str()) << '\'' << "]\n";
} else {
m_stream << "##teamcity[testFailed"
<< " name='" << escape(currentTestCaseInfo->name) << '\''
<< " message='" << escape(msg.str()) << '\'' << "]\n";
m_stream << "##teamcity[testFailed" << " name='"
<< escape(currentTestCaseInfo->name) << '\'' << " message='"
<< escape(msg.str()) << '\'' << "]\n";
}
}
m_stream.flush();
Expand Down
62 changes: 31 additions & 31 deletions tests/cpp/catch2/catch_amalgamated.hpp
Expand Up @@ -164,15 +164,15 @@ class StringRef {
int compare(StringRef rhs) const;
};

constexpr auto operator""_sr(char const *rawChars, std::size_t size) noexcept
-> StringRef {
constexpr auto operator""_sr(char const *rawChars,
std::size_t size) noexcept -> StringRef {
return StringRef(rawChars, size);
}
} // namespace Catch

constexpr auto operator""_catch_sr(char const *rawChars,
std::size_t size) noexcept
-> Catch::StringRef {
constexpr auto
operator""_catch_sr(char const *rawChars,
std::size_t size) noexcept -> Catch::StringRef {
return Catch::StringRef(rawChars, size);
}

Expand Down Expand Up @@ -964,8 +964,8 @@ class LazyExpression {

explicit operator bool() const { return m_transientExpression != nullptr; }

friend auto operator<<(std::ostream &os, LazyExpression const &lazyExpr)
-> std::ostream &;
friend auto operator<<(std::ostream &os,
LazyExpression const &lazyExpr) -> std::ostream &;
};

} // namespace Catch
Expand Down Expand Up @@ -2928,9 +2928,9 @@ template <typename T> std::string rawMemoryToString(const T &object) {

template <typename T> class IsStreamInsertable {
template <typename Stream, typename U>
static auto test(int)
-> decltype(std::declval<Stream &>() << std::declval<U>(),
std::true_type());
static auto test(int) -> decltype(std::declval<Stream &>()
<< std::declval<U>(),
std::true_type());

template <typename, typename> static auto test(...) -> std::false_type;

Expand Down Expand Up @@ -4744,9 +4744,9 @@ class ParserBase {
public:
virtual ~ParserBase() = default;
virtual auto validate() const -> Result { return Result::ok(); }
virtual auto parse(std::string const &exeName,
TokenStream const &tokens) const
-> InternalParseResult = 0;
virtual auto
parse(std::string const &exeName,
TokenStream const &tokens) const -> InternalParseResult = 0;
virtual size_t cardinality() const;

InternalParseResult parse(Args const &args) const;
Expand Down Expand Up @@ -4921,8 +4921,8 @@ class Parser : Detail::ParserBase {

void writeToStream(std::ostream &os) const;

friend auto operator<<(std::ostream &os, Parser const &parser)
-> std::ostream & {
friend auto operator<<(std::ostream &os,
Parser const &parser) -> std::ostream & {
parser.writeToStream(os);
return os;
}
Expand Down Expand Up @@ -5283,8 +5283,8 @@ template <typename LhsT> class ExprLhs {
typename RhsT,
std::enable_if_t<
!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0>
friend auto operator==(ExprLhs &&lhs, RhsT &&rhs)
-> BinaryExpr<LhsT, RhsT const &> {
friend auto operator==(ExprLhs &&lhs,
RhsT &&rhs) -> BinaryExpr<LhsT, RhsT const &> {
return {compareEqual(lhs.m_lhs, rhs), lhs.m_lhs, "=="_sr, rhs};
}
template <typename RhsT,
Expand All @@ -5297,8 +5297,8 @@ template <typename LhsT> class ExprLhs {
typename RhsT,
std::enable_if_t<
!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0>
friend auto operator!=(ExprLhs &&lhs, RhsT &&rhs)
-> BinaryExpr<LhsT, RhsT const &> {
friend auto operator!=(ExprLhs &&lhs,
RhsT &&rhs) -> BinaryExpr<LhsT, RhsT const &> {
return {compareNotEqual(lhs.m_lhs, rhs), lhs.m_lhs, "!="_sr, rhs};
}
template <typename RhsT,
Expand All @@ -5313,12 +5313,12 @@ template <typename LhsT> class ExprLhs {
std::enable_if_t< \
!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> \
friend auto operator op(ExprLhs &&lhs, RhsT &&rhs) \
-> BinaryExpr<LhsT, RhsT const &> { \
->BinaryExpr<LhsT, RhsT const &> { \
return {static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs}; \
} \
template <typename RhsT, \
std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> \
friend auto operator op(ExprLhs &&lhs, RhsT rhs) -> BinaryExpr<LhsT, RhsT> { \
friend auto operator op(ExprLhs &&lhs, RhsT rhs)->BinaryExpr<LhsT, RhsT> { \
return {static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs}; \
}

Expand All @@ -5333,16 +5333,16 @@ template <typename LhsT> class ExprLhs {
#undef CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR

template <typename RhsT>
friend auto operator&&(ExprLhs &&, RhsT &&)
-> BinaryExpr<LhsT, RhsT const &> {
friend auto operator&&(ExprLhs &&,
RhsT &&) -> BinaryExpr<LhsT, RhsT const &> {
static_assert(always_false<RhsT>::value,
"operator&& is not supported inside assertions, "
"wrap the expression inside parentheses, or decompose it");
}

template <typename RhsT>
friend auto operator||(ExprLhs &&, RhsT &&)
-> BinaryExpr<LhsT, RhsT const &> {
friend auto operator||(ExprLhs &&,
RhsT &&) -> BinaryExpr<LhsT, RhsT const &> {
static_assert(always_false<RhsT>::value,
"operator|| is not supported inside assertions, "
"wrap the expression inside parentheses, or decompose it");
Expand Down Expand Up @@ -7903,17 +7903,17 @@ table(std::initializer_list<std::tuple<std::decay_t<Ts>...>> tuples) {
template <typename T> struct as {};

template <typename T, typename... Gs>
auto makeGenerators(GeneratorWrapper<T> &&generator, Gs &&...moreGenerators)
-> Generators<T> {
auto makeGenerators(GeneratorWrapper<T> &&generator,
Gs &&...moreGenerators) -> Generators<T> {
return Generators<T>(CATCH_MOVE(generator), CATCH_FORWARD(moreGenerators)...);
}
template <typename T>
auto makeGenerators(GeneratorWrapper<T> &&generator) -> Generators<T> {
return Generators<T>(CATCH_MOVE(generator));
}
template <typename T, typename... Gs>
auto makeGenerators(T &&val, Gs &&...moreGenerators)
-> Generators<std::decay_t<T>> {
auto makeGenerators(T &&val,
Gs &&...moreGenerators) -> Generators<std::decay_t<T>> {
return makeGenerators(value(CATCH_FORWARD(val)),
CATCH_FORWARD(moreGenerators)...);
}
Expand Down Expand Up @@ -10307,8 +10307,8 @@ void handleExceptionMatchExpr(AssertionHandler &handler,
StringRef matcherString);

template <typename ArgT, typename MatcherT>
auto makeMatchExpr(ArgT &&arg, MatcherT const &matcher, StringRef matcherString)
-> MatchExpr<ArgT, MatcherT> {
auto makeMatchExpr(ArgT &&arg, MatcherT const &matcher,
StringRef matcherString) -> MatchExpr<ArgT, MatcherT> {
return MatchExpr<ArgT, MatcherT>(CATCH_FORWARD(arg), matcher, matcherString);
}

Expand Down

0 comments on commit 7083151

Please sign in to comment.