Skip to content

Commit

Permalink
Create wrapper ApprovalTests.hpp for with add_subdirectory (or similar).
Browse files Browse the repository at this point in the history
See #89.

For now, this file is a manual copy of tests/GoogleTest_Tests/CompileAllIncludes.cpp.
Adding include guards and providing a mechanism to keep it update will be
done in later steps.
  • Loading branch information
claremacrae committed Jan 16, 2020
1 parent b804e87 commit 8a3f68e
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 5 deletions.
72 changes: 72 additions & 0 deletions ApprovalTests/ApprovalTests.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Created with some manual editing of the output of:
// cd ApprovalTests.cpp
// find ApprovalTests -depth -name \*.h\* | sed -e 's/^/#include "/' | sed -e 's/$/"/' | sort

// TODO Add include-guards
// TODO Add mechanism to update this - and check it is kept uptodate
// TODO Remove the other shims elsewhere in the main ApprovalTests.cpp project

#include "ApprovalTests/Approvals.h"
#include "ApprovalTests/CombinationApprovals.h"
#include "ApprovalTests/comparators/ComparatorDisposer.h"
#include "ApprovalTests/comparators/ComparatorFactory.h"
#include "ApprovalTests/comparators/TextFileComparator.h"
#include "ApprovalTests/core/ApprovalComparator.h"
#include "ApprovalTests/core/ApprovalException.h"
#include "ApprovalTests/core/ApprovalNamer.h"
#include "ApprovalTests/core/ApprovalWriter.h"
#include "ApprovalTests/core/FileApprover.h"
#include "ApprovalTests/core/Reporter.h"
#include "ApprovalTests/integrations/CheckFileMacroIsAbsolute.h"
#include "ApprovalTests/integrations/catch/Catch2Approvals.h"
#include "ApprovalTests/integrations/doctest/DocTestApprovals.h"
#include "ApprovalTests/integrations/google/GoogleConfiguration.h"
#include "ApprovalTests/integrations/google/GoogleCustomizationsFactory.h"
#include "ApprovalTests/integrations/google/GoogleTestApprovals.h"
#include "ApprovalTests/integrations/ut/UTApprovals.h"
#include "ApprovalTests/launchers/CommandLauncher.h"
#include "ApprovalTests/launchers/SystemLauncher.h"
#include "ApprovalTests/namers/ApprovalTestNamer.h"
#include "ApprovalTests/namers/DefaultNamerDisposer.h"
#include "ApprovalTests/namers/DefaultNamerFactory.h"
#include "ApprovalTests/namers/ExistingFileNamer.h"
#include "ApprovalTests/namers/HelpMessages.h"
#include "ApprovalTests/namers/NamerFactory.h"
#include "ApprovalTests/namers/SectionNameDisposer.h"
#include "ApprovalTests/namers/SeparateApprovedAndReceivedDirectoriesNamer.h"
#include "ApprovalTests/namers/SubdirectoryDisposer.h"
#include "ApprovalTests/reporters/AutoApproveIfMissingReporter.h"
#include "ApprovalTests/reporters/AutoApproveReporter.h"
#include "ApprovalTests/reporters/BlockingReporter.h"
#include "ApprovalTests/reporters/CIBuildOnlyReporter.h"
#include "ApprovalTests/reporters/CIBuildOnlyReporterUtils.h"
#include "ApprovalTests/reporters/ClipboardReporter.h"
#include "ApprovalTests/reporters/CombinationReporter.h"
#include "ApprovalTests/reporters/CommandReporter.h"
#include "ApprovalTests/reporters/DefaultFrontLoadedReporter.h"
#include "ApprovalTests/reporters/DefaultReporter.h"
#include "ApprovalTests/reporters/DefaultReporterDisposer.h"
#include "ApprovalTests/reporters/DefaultReporterFactory.h"
#include "ApprovalTests/reporters/DiffInfo.h"
#include "ApprovalTests/reporters/DiffPrograms.h"
#include "ApprovalTests/reporters/DiffReporter.h"
#include "ApprovalTests/reporters/FirstWorkingReporter.h"
#include "ApprovalTests/reporters/FrontLoadedReporterDisposer.h"
#include "ApprovalTests/reporters/FrontLoadedReporterFactory.h"
#include "ApprovalTests/reporters/GenericDiffReporter.h"
#include "ApprovalTests/reporters/LinuxReporters.h"
#include "ApprovalTests/reporters/MacReporters.h"
#include "ApprovalTests/reporters/QuietReporter.h"
#include "ApprovalTests/reporters/WindowsReporters.h"
#include "ApprovalTests/utilities/Blocker.h"
#include "ApprovalTests/utilities/CartesianProduct.h"
#include "ApprovalTests/utilities/ExceptionCollector.h"
#include "ApprovalTests/utilities/FileUtils.h"
#include "ApprovalTests/utilities/FileUtilsSystemSpecific.h"
#include "ApprovalTests/utilities/MachineBlocker.h"
#include "ApprovalTests/utilities/Macros.h"
#include "ApprovalTests/utilities/StringUtils.h"
#include "ApprovalTests/utilities/SystemUtils.h"
#include "ApprovalTests/utilities/WinMinGWUtils.h"
#include "ApprovalTests/writers/ExistingFile.h"
#include "ApprovalTests/writers/StringWriter.h"
4 changes: 3 additions & 1 deletion ApprovalTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ set(CMAKE_CXX_STANDARD 11)
add_library(${PROJECT_NAME} INTERFACE)
add_library(ApprovalTests::ApprovalTests ALIAS ApprovalTests)
target_include_directories(${PROJECT_NAME}
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/..)
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/..
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_options(${PROJECT_NAME} INTERFACE $<$<CXX_COMPILER_ID:MSVC>:/FC>)

if(("${CMAKE_GENERATOR}" MATCHES "Ninja") AND (${CMAKE_UNITY_BUILD}))
Expand Down
2 changes: 0 additions & 2 deletions examples/catch2_existing_main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ add_executable(${PROJECT_NAME}
Catch2ApprovalsTests.cpp
)
target_link_libraries(${PROJECT_NAME} ApprovalTests::ApprovalTests Catch2::Catch2)
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/Catch2_Tests)

add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
2 changes: 0 additions & 2 deletions examples/googletest_existing_main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ add_executable(${PROJECT_NAME}
main.cpp
GoogleTestApprovalsTests.cpp
)
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/GoogleTest_Tests)
target_link_libraries(${PROJECT_NAME} ApprovalTests::ApprovalTests gtest gtest_main)

add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})

0 comments on commit 8a3f68e

Please sign in to comment.