Debian Codegraph @

Tests/RunCMake/string/GenexpStrip.cmake

raw
1 function(test_strip input expected)
2 string(GENEX_STRIP "${input}" strip)
3 if (NOT strip STREQUAL expected)
4 message(FATAL_ERROR "message(GENEXP_STRIP \"${input}\")
5 evaluated to \"${strip}\"
6 expected \"${expected}\"")
7 endif()
8 endfunction()
9
10 test_strip( # Simple case
11 "$<BOOL:1>"
12 ""
13 )
14 test_strip( # LHS contains generator expression
15 "$<$<CONFIG:Release>:NDEBUG>;DEBUG"
16 "DEBUG"
17 )
18 test_strip( # RHS contains generator expression
19 "$<AND:1,$<BOOL:TRUE>>"
20 ""
21 )
22 test_strip( # Empty and unfinished expressions
23 "$<>$<$<>"
24 "$<$<>"
25 )
26 test_strip( # Multiple independent expressions
27 "$<IF:TRUE,TRUE,FALSE> / $<IF:TRUE,TRUE,FALSE>"
28 " / "
29 )
30 test_strip( # Multiple : in one expression
31 "$<1:2:3>"
32 ""
33 )
34 test_strip( # Multiple case
35 "1$<AND:1,0>2$<IF:$<$<BOOL:1>:$<CONFIG:RELEASE>>,TRUE,FALSE>3"
36 "123"
37 )
38 test_strip( # No : inside of :
39 "$<1:$<SEMICOLON>>1"
40 "1"
41 )