Skip to content

Commit

Permalink
test: include Assertion module using name instead of full path
Browse files Browse the repository at this point in the history
Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
  • Loading branch information
threeal committed Oct 22, 2024
1 parent 1534a56 commit bc97720
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ include(Assertion)
if(ASSERTION_ENABLE_TESTS)
enable_testing()

list(APPEND CMAKE_SCRIPT_TEST_DEFINITIONS CMAKE_MODULE_PATH)

add_cmake_script_test(test/test_add_test.cmake)
add_cmake_script_test(test/test_assert_call.cmake)
add_cmake_script_test(test/test_assert_number.cmake)
Expand Down
3 changes: 1 addition & 2 deletions test/test_add_test.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.24)

include(${CMAKE_CURRENT_LIST_DIR}/../cmake/Assertion.cmake
RESULT_VARIABLE ASSERTION_LIST_FILE)
include(Assertion RESULT_VARIABLE ASSERTION_LIST_FILE)

set(CMAKELISTS_HEADER
"cmake_minimum_required(VERSION 3.24)\n"
Expand Down
3 changes: 1 addition & 2 deletions test/test_assert.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.24)

include(${CMAKE_CURRENT_LIST_DIR}/../cmake/Assertion.cmake
RESULT_VARIABLE ASSERTION_LIST_FILE)
include(Assertion RESULT_VARIABLE ASSERTION_LIST_FILE)

file(MAKE_DIRECTORY sample-project)

Expand Down
2 changes: 1 addition & 1 deletion test/test_assert_call.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.24)

include(${CMAKE_CURRENT_LIST_DIR}/../cmake/Assertion.cmake)
include(Assertion)

function(throw_errors)
message(SEND_ERROR "a send error message")
Expand Down
2 changes: 1 addition & 1 deletion test/test_assert_number.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.24)

include(${CMAKE_CURRENT_LIST_DIR}/../cmake/Assertion.cmake)
include(Assertion)

set(SEVEN_VAR 7)
set(THIRTEEN_VAR 13)
Expand Down
2 changes: 1 addition & 1 deletion test/test_assert_process.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.24)

include(${CMAKE_CURRENT_LIST_DIR}/../cmake/Assertion.cmake)
include(Assertion)

section("assert process executions")
section("it should assert process executions")
Expand Down
2 changes: 1 addition & 1 deletion test/test_assert_string.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.24)

include(${CMAKE_CURRENT_LIST_DIR}/../cmake/Assertion.cmake)
include(Assertion)

set(STRING_VAR "a string")
set(OTHER_STRING_VAR "another string")
Expand Down
2 changes: 1 addition & 1 deletion test/test_assert_version.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.24)

include(${CMAKE_CURRENT_LIST_DIR}/../cmake/Assertion.cmake)
include(Assertion)

set(VERSION_VAR 1.2.3)
set(VERSIONN_VAR 1.02.3)
Expand Down
2 changes: 1 addition & 1 deletion test/test_fail.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.24)

include(${CMAKE_CURRENT_LIST_DIR}/../cmake/Assertion.cmake)
include(Assertion)

section("it should fail with formatted fatal error messages given strings")
assert_call(fail "single line string"
Expand Down

0 comments on commit bc97720

Please sign in to comment.