From 2ef55c439cfee0bd6f28d27cbf5e0be3a2e82f9d Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 4 Apr 2017 21:00:48 +0200 Subject: [PATCH] Add tidy test --- cmake/modules/BasicConfig.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index 251e9e7..06f1673 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -208,6 +208,15 @@ if(EXISTS "${CLANG_FORMAT_RULES}") COMMENT "Linking coding style from ${CLANG_FORMAT_RULES}" ) add_dependencies("${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_tidy" "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_link_codingstyle") + + # also add a test to verify whether sources are tidy + add_test(NAME "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_tidy_test" + COMMAND "${CLANG_FORMAT_BIN}" -output-replacements-xml -style=file ${FORMATABLE_FILES} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + ) + set_tests_properties("${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_tidy_test" PROPERTIES + FAIL_REGULAR_EXPRESSION ".*" + ) endif() else() message(WARNING "clang-format not found; unable to add tidy target")