build: Fix a regression when adding new example tests. (#2337)

If the example had a text output, it would cause an error

Regression from b5ca8bf93
This commit is contained in:
Emmanuel Lepage Vallée 2018-08-06 09:05:31 -04:00 committed by GitHub
parent aab582c0a0
commit dd7161ee0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -244,7 +244,9 @@ function(run_test test_path namespace escaped_content)
# If there is an output, assume it is relevant and add it to the
# documentation under the image.
if(tmp_content MATCHES "--DOC_GEN_OUTPUT")
file(READ "${expected_output_path}" expected_output)
if(EXISTS "${expected_output_path}")
file(READ "${expected_output_path}" expected_output)
endif()
set(TEST_DOC_CONTENT
"${TEST_DOC_CONTENT}\n${DOC_LINE_PREFIX}\n${DOC_LINE_PREFIX}**Usage example output**:\n${DOC_LINE_PREFIX}"