Tests: Quote possibly empty string(REPLACE) argument

The ${unity_source_line} variable should not normally be empty,
but it has been observed that it sometimes is due to other factors.
Rather than causing string(REPLACE) to fail due to the wrong
number of arguments, quote the variable so that the
UnityBuildPre2017 test case fails with a more appropriate
error in the block just after the usage fixed by this change.
This commit is contained in:
Craig Scott
2024-01-01 11:58:22 +11:00
parent 5a4d7c254f
commit d0f395525f

View File

@@ -27,7 +27,7 @@ foreach(line IN LISTS tgt_projects_strings)
endif()
endforeach()
string(REPLACE "\\" "/" unity_source_line ${unity_source_line})
string(REPLACE "\\" "/" unity_source_line "${unity_source_line}")
string(FIND "${unity_source_line}" "CMakeFiles/tgt.dir/Unity/unity_0_c.c" unity_source_file_position)
if (unity_source_file_position EQUAL "-1")
set(RunCMake_TEST_FAILED "Generated project should include the generated unity source file.")