mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
Tests/CXXModules: fix error detection propagation
This commit is contained in:
@@ -32,3 +32,5 @@ else ()
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents)
|
||||
check_json("${actual_contents}" "${expect_contents}")
|
||||
endif ()
|
||||
|
||||
string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
|
||||
|
||||
@@ -32,3 +32,5 @@ else ()
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-private.json" expect_contents)
|
||||
check_json("${actual_contents}" "${expect_contents}")
|
||||
endif ()
|
||||
|
||||
string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
|
||||
|
||||
@@ -32,3 +32,5 @@ else ()
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-private.json" expect_contents)
|
||||
check_json("${actual_contents}" "${expect_contents}")
|
||||
endif ()
|
||||
|
||||
string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
|
||||
|
||||
@@ -22,6 +22,7 @@ function (check_json_value path actual_type expect_type actual_value expect_valu
|
||||
if (NOT actual_type STREQUAL expect_type)
|
||||
list(APPEND RunCMake_TEST_FAILED
|
||||
"Type mismatch at ${path}: ${actual_type} vs. ${expect_type}")
|
||||
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
|
||||
return ()
|
||||
endif ()
|
||||
|
||||
@@ -53,6 +54,8 @@ function (check_json_value path actual_type expect_type actual_value expect_valu
|
||||
elseif (actual_type STREQUAL OBJECT)
|
||||
check_json_object("${path}" "${actual_value}" "${expect_value}")
|
||||
endif ()
|
||||
|
||||
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# Check that two arrays are the same.
|
||||
@@ -82,6 +85,8 @@ function (check_json_array path actual expect)
|
||||
string(JSON expect_value GET "${expect}" "${idx}")
|
||||
check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}")
|
||||
endforeach ()
|
||||
|
||||
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# Check that two inner objects are the same.
|
||||
@@ -148,13 +153,15 @@ function (check_json_object path actual expect)
|
||||
string(JSON expect_value GET "${expect}" "${key}")
|
||||
check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}")
|
||||
endforeach ()
|
||||
|
||||
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# Check that two JSON objects are the same.
|
||||
function (check_json actual expect)
|
||||
check_json_object("" "${actual}" "${expect}")
|
||||
|
||||
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
|
||||
|
||||
cmake_policy(POP)
|
||||
|
||||
Reference in New Issue
Block a user