mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Tests: Detect a malformed genex in the PATH:IS_PREFIX test
The final assertion opened a generator expression and never closed it. file(GENERATE) passes such a string through verbatim rather than diagnosing it, and the result is a non-empty string, so an assertion that tests only for truth cannot fail. That case has been vacuous since it was added. Close the expression, and compare each result against the exact value the operation returns rather than against its truthiness, so that a malformed expression is reported instead of quietly satisfying the check.
This commit is contained in:
@@ -3,21 +3,21 @@ include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
|
||||
unset (errors)
|
||||
|
||||
set(output "$<PATH:IS_PREFIX,a///b/c,a/b/c/d>")
|
||||
if (NOT output)
|
||||
if (NOT output STREQUAL "1")
|
||||
list (APPEND errors "'a///b/c' is not prefix of 'a/b/c/d'")
|
||||
endif()
|
||||
|
||||
set(output "$<PATH:IS_PREFIX,a///b/c/../d,a/b/d/e>")
|
||||
if (output)
|
||||
if (NOT output STREQUAL "0")
|
||||
list (APPEND errors "'a///b/c/../d' is prefix of 'a/b/d/e'")
|
||||
endif()
|
||||
set(output "$<PATH:IS_PREFIX,NORMALIZE,a///b/c/../d,a/b/d/e>")
|
||||
if (NOT output)
|
||||
if (NOT output STREQUAL "1")
|
||||
list (APPEND errors "'a///b/c/../d' is not prefix of 'a/b/d/e'")
|
||||
endif()
|
||||
|
||||
set(output "$<PATH:IS_PREFIX,NORMALIZE,/a/b/..,/a/c/../b")
|
||||
if (NOT output)
|
||||
set(output "$<PATH:IS_PREFIX,NORMALIZE,/a/b/..,/a/c/../b>")
|
||||
if (NOT output STREQUAL "1")
|
||||
list (APPEND errors "'/a/b/..' is not prefix of '/a/c/../b'")
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user