chore(tests): try to generate coverage better (#5972)
This commit is contained in:
@@ -47,6 +47,16 @@ project(chatterino
|
|||||||
HOMEPAGE_URL "https://chatterino.com/"
|
HOMEPAGE_URL "https://chatterino.com/"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(CHATTERINO_GENERATE_COVERAGE)
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
|
||||||
|
add_link_options(-fprofile-instr-generate -fcoverage-mapping)
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
|
add_compile_options(-coverage)
|
||||||
|
add_link_options(-coverage)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CHATTERINO_LTO)
|
if(CHATTERINO_LTO)
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
check_ipo_supported(RESULT CHATTERINO_ENABLE_LTO OUTPUT IPO_ERROR)
|
check_ipo_supported(RESULT CHATTERINO_ENABLE_LTO OUTPUT IPO_ERROR)
|
||||||
|
|||||||
@@ -425,6 +425,55 @@ TEST(String, MoveAssign)
|
|||||||
ASSERT_TRUE(u.isEmpty());
|
ASSERT_TRUE(u.isEmpty());
|
||||||
ASSERT_EQ(u.view(), "");
|
ASSERT_EQ(u.view(), "");
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
String u(REALLY_LONG);
|
||||||
|
ASSERT_FALSE(u.isQt());
|
||||||
|
ASSERT_TRUE(u.isAlloc());
|
||||||
|
ASSERT_FALSE(u.isEmpty());
|
||||||
|
ASSERT_EQ(u.qt(), REALLY_LONG);
|
||||||
|
ASSERT_TRUE(u.isQt());
|
||||||
|
ASSERT_FALSE(u.isAlloc());
|
||||||
|
ASSERT_FALSE(u.isEmpty());
|
||||||
|
String v(REALLY_LONG);
|
||||||
|
ASSERT_FALSE(v.isQt());
|
||||||
|
ASSERT_TRUE(v.isAlloc());
|
||||||
|
ASSERT_FALSE(v.isEmpty());
|
||||||
|
v = std::move(u);
|
||||||
|
ASSERT_TRUE(v.isQt());
|
||||||
|
ASSERT_FALSE(v.isAlloc());
|
||||||
|
ASSERT_FALSE(v.isEmpty());
|
||||||
|
ASSERT_EQ(v.view(), REALLY_LONG);
|
||||||
|
ASSERT_FALSE(u.isQt());
|
||||||
|
ASSERT_FALSE(u.isAlloc());
|
||||||
|
ASSERT_TRUE(u.isEmpty());
|
||||||
|
ASSERT_EQ(u.view(), "");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
String u(REALLY_LONG);
|
||||||
|
ASSERT_FALSE(u.isQt());
|
||||||
|
ASSERT_TRUE(u.isAlloc());
|
||||||
|
ASSERT_FALSE(u.isEmpty());
|
||||||
|
ASSERT_EQ(u.qt(), REALLY_LONG);
|
||||||
|
ASSERT_TRUE(u.isQt());
|
||||||
|
ASSERT_FALSE(u.isAlloc());
|
||||||
|
ASSERT_FALSE(u.isEmpty());
|
||||||
|
String v(REALLY_LONG);
|
||||||
|
ASSERT_FALSE(v.isQt());
|
||||||
|
ASSERT_TRUE(v.isAlloc());
|
||||||
|
ASSERT_FALSE(v.isEmpty());
|
||||||
|
ASSERT_EQ(v.qt(), REALLY_LONG);
|
||||||
|
ASSERT_TRUE(v.isQt());
|
||||||
|
ASSERT_FALSE(v.isAlloc());
|
||||||
|
v = std::move(u);
|
||||||
|
ASSERT_TRUE(v.isQt());
|
||||||
|
ASSERT_FALSE(v.isAlloc());
|
||||||
|
ASSERT_FALSE(v.isEmpty());
|
||||||
|
ASSERT_EQ(v.view(), REALLY_LONG);
|
||||||
|
ASSERT_FALSE(u.isQt());
|
||||||
|
ASSERT_FALSE(u.isAlloc());
|
||||||
|
ASSERT_TRUE(u.isEmpty());
|
||||||
|
ASSERT_EQ(u.view(), "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(String, QtLifetime)
|
TEST(String, QtLifetime)
|
||||||
|
|||||||
+1
-4
@@ -781,10 +781,7 @@ endif()
|
|||||||
|
|
||||||
if (CHATTERINO_GENERATE_COVERAGE)
|
if (CHATTERINO_GENERATE_COVERAGE)
|
||||||
include(CodeCoverage)
|
include(CodeCoverage)
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
||||||
target_compile_options(${LIBRARY_PROJECT} PRIVATE -coverage)
|
|
||||||
target_link_options(${LIBRARY_PROJECT} PRIVATE -coverage)
|
|
||||||
else()
|
|
||||||
append_coverage_compiler_flags_to_target(${LIBRARY_PROJECT})
|
append_coverage_compiler_flags_to_target(${LIBRARY_PROJECT})
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "project source dir: ${PROJECT_SOURCE_DIR}/src")
|
message(STATUS "project source dir: ${PROJECT_SOURCE_DIR}/src")
|
||||||
|
|||||||
Reference in New Issue
Block a user