tests: Improve the CMakeLists.txt

* Add a FOLLOW_SYMLINKS so Awesome 3rd party module can share the
  awesome test infrastructure by adding themselves as symlinks in
  `lib/`, `tests/` and `tests/examples` and otherwise use AwesomeWM
  Travis config.

* Add an option to add examples to the C documentation. Previously only
  Lua functions could be documented using this framework.
This commit is contained in:
Emmanuel Lepage Vallee 2018-07-21 14:10:54 -04:00
parent 94d3918d14
commit c340c14cf2
1 changed files with 6 additions and 4 deletions

View File

@ -171,9 +171,11 @@ function(run_test test_path namespace escaped_content)
file(READ ${test_path} tmp_content)
# Add "--" in front of each line. This is required for method doc, but not
# for documentation pages
if(NOT tmp_content MATCHES "--DOC_NO_DASH")
# Add "--" or " * " in front of each line. This is required for method doc,
#but not for documentation pages
if(tmp_content MATCHES "--DOC_ASTERISK")
set(DOC_LINE_PREFIX " * ")
elseif(NOT tmp_content MATCHES "--DOC_NO_DASH")
set(DOC_LINE_PREFIX "--")
endif()
@ -279,7 +281,7 @@ function(run_test test_path namespace escaped_content)
endfunction()
# Find all test files, and run them (generating custom commands for updating them).
file(GLOB_RECURSE test_files LIST_DIRECTORIES false
file(GLOB_RECURSE test_files FOLLOW_SYMLINKS LIST_DIRECTORIES false
"${TOP_SOURCE_DIR}/tests/examples/*.lua")
# Find and run all test files.