summaryrefslogtreecommitdiff
path: root/Tests/Unset
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Unset')
-rw-r--r--Tests/Unset/CMakeLists.txt27
1 files changed, 27 insertions, 0 deletions
diff --git a/Tests/Unset/CMakeLists.txt b/Tests/Unset/CMakeLists.txt
index 781da3fa62..07aa68e7ae 100644
--- a/Tests/Unset/CMakeLists.txt
+++ b/Tests/Unset/CMakeLists.txt
@@ -51,5 +51,32 @@ if(DEFINED BAR)
message(FATAL_ERROR "BAR still defined")
endif()
+# Test unset(... PARENT_SCOPE)
+function(unset_zots)
+ if(NOT DEFINED ZOT1)
+ message(FATAL_ERROR "ZOT1 is not defined inside function")
+ endif()
+ if(NOT DEFINED ZOT2)
+ message(FATAL_ERROR "ZOT2 is not defined inside function")
+ endif()
+ unset(ZOT1)
+ unset(ZOT2 PARENT_SCOPE)
+ if(DEFINED ZOT1)
+ message(FATAL_ERROR "ZOT1 is defined inside function after unset")
+ endif()
+ if(NOT DEFINED ZOT2)
+ message(FATAL_ERROR
+ "ZOT2 is not defined inside function after unset(... PARENT_SCOPE)")
+ endif()
+endfunction()
+set(ZOT1 1)
+set(ZOT2 2)
+unset_zots()
+if(NOT DEFINED ZOT1)
+ message(FATAL_ERROR "ZOT1 is not still defined after function")
+endif()
+if(DEFINED ZOT2)
+ message(FATAL_ERROR "ZOT2 is still defined after function unset PARENT_SCOPE")
+endif()
add_executable(Unset unset.c)