Skip to content
Snippets Groups Projects
Commit 4cf29418 authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

fix

parent abccf0d5
No related branches found
No related tags found
No related merge requests found
......@@ -105,8 +105,10 @@ function(gtest target test_source_files linktarget)
set_tests_properties(test-${target} PROPERTIES LABELS "unit;all")
message(STATUS "Added test 'test-${target}'")
if (CMAKE_COMPILER_IS_GNUCXX)
if (ARGN)
LIST(GET ${ARGN} 0 NOCOV)
endif()
if (CMAKE_COMPILER_IS_GNUCXX AND NOT 1${NOCOV} STREQUAL "1nocov")
set(COVERAGE_EXCLUDES "*/unittests/*" "*/3d_party/*" "*/python/*")
if (ARGN)
set(COVERAGE_EXCLUDES ${COVERAGE_EXCLUDES} ${ARGN})
......@@ -116,6 +118,8 @@ function(gtest target test_source_files linktarget)
COMMAND ${CMAKE_MODULE_PATH}/check_test.sh
coverage-${target} ${CMAKE_BINARY_DIR} ${ASAPO_MINIMUM_COVERAGE})
set_tests_properties(coveragetest-${target} PROPERTIES LABELS "coverage;all")
message(STATUS "Added test 'test-${target}-coverage'")
SET_TESTS_PROPERTIES(coveragetest-${target} PROPERTIES DEPENDS test-${target})
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE)
......
......@@ -27,5 +27,5 @@ set(TEST_SOURCE_FILES ../../unittests/database/test_encoding.cpp)
set(TEST_LIBRARIES "${TARGET_NAME}")
include_directories(${ASAPO_CXX_COMMON_INCLUDE_DIR})
gtest(${TARGET_NAME} "${TEST_SOURCE_FILES}" "${TEST_LIBRARIES}" "*mongodb_client*" "*database.*")
gtest(${TARGET_NAME} "${TEST_SOURCE_FILES}" "${TEST_LIBRARIES}" "nocov")
......@@ -85,9 +85,14 @@ std::string EncodeColName(const std::string &colname) {
}
std::string DecodeName(const std::string &name) {
std::unique_ptr<char>decoded{new char(name.size())};
auto res = decode(name.c_str(), decoded.get());
return res >= 0 ? decoded.get() : "";
char* decoded = new char[name.size() + 1];
auto res = decode(name.c_str(), decoded);
if (res < 0) {
return "";
}
std::string str = std::string{decoded};
delete[] decoded;
return str;
}
bool ShouldEscapeQuery(char c) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment