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:
Mickaël Germain
2026-09-07 20:29:29 -07:00
parent 026c254a8e
commit 59a096f73b
+5 -5
View File
@@ -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()