瀏覽代碼

RunCMake: Add RunCMake_TEST_NOT_EXPECT variables

Orkun Tokdemir 2 年之前
父節點
當前提交
e5358b9d8d
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      Tests/RunCMake/RunCMake.cmake

+ 10 - 0
Tests/RunCMake/RunCMake.cmake

@@ -53,6 +53,11 @@ function(run_cmake test)
       unset(expect_${o})
     endif()
   endforeach()
+  foreach(o IN ITEMS stdout stderr config)
+    if(DEFINED RunCMake_TEST_NOT_EXPECT_${o})
+      string(REGEX REPLACE "\n+$" "" not_expect_${o} "${RunCMake_TEST_NOT_EXPECT_${o}}")
+    endif()
+  endforeach()
   if (NOT expect_stderr)
     if (NOT RunCMake_DEFAULT_stderr)
       set(RunCMake_DEFAULT_stderr "^$")
@@ -216,6 +221,11 @@ function(run_cmake test)
         string(APPEND msg "${o} does not match that expected.\n")
       endif()
     endif()
+    if(DEFINED not_expect_${o})
+      if("${actual_${o}}" MATCHES "${not_expect_${o}}")
+        string(APPEND msg "${o} matches that not expected.\n")
+      endif()
+    endif()
   endforeach()
   unset(RunCMake_TEST_FAILED)
   if(RunCMake-check-file AND EXISTS ${top_src}/${RunCMake-check-file})