mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-30 02:59:22 -05:00
Tests: Fix RunCMake.FileAPI test with jsoncpp < 1.7.5
Prior to jsoncpp commit `126bdc2b05` (Reject extra chars if strictRoot, 2016-08-21, 1.7.5~2), it did not diagnose trailing characters in the input after a JSON value. Teach our corresponding test case to tolerate the old behavior.
This commit is contained in:
@@ -305,6 +305,9 @@ add_RunCMake_test(ExportImport)
|
|||||||
add_RunCMake_test(ExternalData)
|
add_RunCMake_test(ExternalData)
|
||||||
add_RunCMake_test(FeatureSummary)
|
add_RunCMake_test(FeatureSummary)
|
||||||
add_RunCMake_test(FPHSA)
|
add_RunCMake_test(FPHSA)
|
||||||
|
if(CMAKE_USE_SYSTEM_JSONCPP)
|
||||||
|
list(APPEND FileAPI_ARGS -DJsonCpp_VERSION_STRING=${JsonCpp_VERSION_STRING})
|
||||||
|
endif()
|
||||||
add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE}
|
add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE}
|
||||||
-DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID})
|
-DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID})
|
||||||
add_RunCMake_test(FindBoost)
|
add_RunCMake_test(FindBoost)
|
||||||
|
|||||||
@@ -108,7 +108,11 @@ def check_query_json_empty(q):
|
|||||||
check_error_re(q, "value, object or array expected")
|
check_error_re(q, "value, object or array expected")
|
||||||
|
|
||||||
def check_query_json_extra(q):
|
def check_query_json_extra(q):
|
||||||
check_error_re(q, "Extra non-whitespace after JSON value")
|
if bool(os.environ.get("CMake_JSONCPP_PRE_1_7_5", "")) and is_dict(q) and sorted(q.keys()) == ["responses"]:
|
||||||
|
# jsoncpp < 1.7.5 did not diagnose extra non-whitespace characters
|
||||||
|
check_error(q["responses"], "'requests' member missing")
|
||||||
|
else:
|
||||||
|
check_error_re(q, "Extra non-whitespace after JSON value")
|
||||||
|
|
||||||
def check_query_not_file(q):
|
def check_query_not_file(q):
|
||||||
check_error_re(q, "failed to read from file")
|
check_error_re(q, "failed to read from file")
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
|
|||||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo")
|
set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(JsonCpp_VERSION_STRING AND JsonCpp_VERSION_STRING VERSION_LESS 1.7.5)
|
||||||
|
set(ENV{CMake_JSONCPP_PRE_1_7_5} 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
run_cmake(Nothing)
|
run_cmake(Nothing)
|
||||||
run_cmake(Empty)
|
run_cmake(Empty)
|
||||||
run_cmake(EmptyClient)
|
run_cmake(EmptyClient)
|
||||||
|
|||||||
Reference in New Issue
Block a user