mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 06:37:43 -05:00
* Add ASSERT_CONTENTS_EQUAL test macro in testing.cmake Checks if the contents of a file matches the given input * Use shorter hashes with CPM_SOURCE_CACHE (#624) Uses shorter hashes with CPM_SOURCE_CACHE. Falls back to a longer hash if necessary (ie, if there's a collision with an existing hash). See: https://github.com/cpm-cmake/CPM.cmake/issues/624 * Update integration tests to support shorter hashes * trigger ci * run cmake-format * if already available, use the legacy cache hash * create temporary file in current binary dir * add test case for legacy hash --------- Co-authored-by: Lars Melchior <lars.melchior@gmail.com> Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d7614381ab
commit
d9364ce284
@@ -79,3 +79,16 @@ function(ASSERT_NOT_EXISTS file)
|
||||
message(FATAL_ERROR "assertion failed: file ${file} exists")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ASSERT_CONTENTS_EQUAL file content)
|
||||
if(EXISTS ${file})
|
||||
file(READ ${file} file_content)
|
||||
if(content STREQUAL file_content)
|
||||
message(STATUS "test passed: '${file}' exists and contains '${content}'")
|
||||
else()
|
||||
message(FATAL_ERROR "assertion failed: file '${file}' does not contain expected content.")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "assertion failed: file '${file} does not exist")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user