Skip to content

Commit

Permalink
test: simplify test files organization (#75)
Browse files Browse the repository at this point in the history
* test: move recursive directory creation tests to `MkdirRecursive.cmake`

* test: declare tests in top-level `CMakeLists.txt`
  • Loading branch information
threeal authored Jun 21, 2024
1 parent 1fb5d95 commit 285acb7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 38 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ include(cmake/MkdirRecursive.cmake)

if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
enable_testing()
add_subdirectory(test)

add_test(
NAME "recursive directory creation"
COMMAND "${CMAKE_COMMAND}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/MkdirRecursive.cmake)
endif()

if(MY_MKDIR_ENABLE_INSTALL)
Expand Down
17 changes: 0 additions & 17 deletions test/CMakeLists.txt

This file was deleted.

11 changes: 11 additions & 0 deletions test/MkdirRecursive.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.5)

find_package(MyMkdir REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR}/../../cmake)

file(REMOVE_RECURSE parent)

mkdir_recursive(parent/child)

if(NOT EXISTS parent/child)
message(FATAL_ERROR "expected path 'parent/child' to exist")
endif()
20 changes: 0 additions & 20 deletions test/cmake/MkdirRecursiveTest.cmake

This file was deleted.

0 comments on commit 285acb7

Please sign in to comment.