Fix various useful clang-tidy warnings

* bugprone-branch-clone
* bugprone-copy-constructor-init
* bugprone-empty-catch
* bugprone-sizeof-expression
* bugprone-switch-missing-default-case
* bugprone-unused-local-non-trivial-variable
* clang-analyzer-core.uninitialized.Assign
* clang-analyzer-cplusplus.Move
* clang-analyzer-optin.cplusplus.VirtualCall
* modernize-loop-convert
* modernize-raw-string-literal
* modernize-use-equals-default
* modernize-use-override
* modernize-use-using
* performance-avoid-endl
* performance-inefficient-string-concatenation
* performance-inefficient-vector-operation
* performance-noexcept-move-constructor
* performance-unnecessary-value-param (and improve generator example)
* readability-duplicate-include
* readability-inconsistent-declaration-parameter-name
* readability-non-const-parameter
* readability-redundant-casting
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-static-accessed-through-instance
* unused variable in amalgamted tests
This commit is contained in:
Martin Jeřábek
2024-03-01 11:15:27 +01:00
committed by Martin Hořeňovský
parent 7677c1658e
commit cde3509664
39 changed files with 86 additions and 87 deletions

View File

@@ -120,13 +120,13 @@ TEST_CASE( "Optional supports move ops", "[optional][approvals]" ) {
}
SECTION( "Move construction from optional" ) {
Optional<MoveChecker> opt_B( CATCH_MOVE( opt_A ) );
REQUIRE( opt_A->has_moved );
REQUIRE( opt_A->has_moved ); // NOLINT(clang-analyzer-cplusplus.Move)
}
SECTION( "Move assignment from optional" ) {
Optional<MoveChecker> opt_B( opt_A );
REQUIRE_FALSE( opt_A->has_moved );
opt_B = CATCH_MOVE( opt_A );
REQUIRE( opt_A->has_moved );
REQUIRE( opt_A->has_moved ); // NOLINT(clang-analyzer-cplusplus.Move)
}
}

View File

@@ -18,7 +18,6 @@
#include <catch2/generators/catch_generators_adapters.hpp>
#include <catch2/generators/catch_generators_random.hpp>
#include <catch2/generators/catch_generators_range.hpp>
#include <catch2/generators/catch_generator_exception.hpp>
// Tests of generator implementation details
TEST_CASE("Generators internals", "[generators][internals]") {

View File

@@ -107,7 +107,7 @@ TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) {
for (auto const& factory : factories) {
INFO("Tested reporter: " << factory.first);
auto sstream = Catch::Detail::make_unique<StringIStream>();
auto& sstreamRef = *sstream.get();
auto& sstreamRef = *sstream;
Catch::ConfigData cfg_data;
cfg_data.rngSeed = 1234;

View File

@@ -236,7 +236,7 @@ TEST_CASE( "Parse test names and tags", "[command-line][test-spec][approvals]" )
CHECK( spec.matches( *tcD ) == false );
}
SECTION( "two wildcarded names" ) {
TestSpec spec = parseTestSpec( "\"longer*\"\"*spaces\"" );
TestSpec spec = parseTestSpec( R"("longer*""*spaces")" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );

View File

@@ -152,7 +152,7 @@ TEST_CASE( "TextFlow::Column respects indentation for empty lines",
std::string written = as_written(col);
REQUIRE(as_written(col) == " \n \n third line");
REQUIRE(written == " \n \n third line");
}
TEST_CASE( "TextFlow::Column leading/trailing whitespace",