ソースを参照

add a test for escape quotes and configure file

Bill Hoffman 23 年 前
コミット
14b07c0973

+ 6 - 0
Tests/Complex/CMakeLists.txt

@@ -156,6 +156,12 @@ CONFIGURE_FILE(
   ${Complex_SOURCE_DIR}/cmTestConfigure.h.in
   ${Complex_BINARY_DIR}/cmTestConfigure.h)
 
+SET(STRING_WITH_QUOTES "\"hello world\"")
+# test CONFIGURE_FILE with ESCAPE_QUOTES on
+CONFIGURE_FILE(
+  ${Complex_SOURCE_DIR}/cmTestConfigureEscape.h.in
+  ${Complex_BINARY_DIR}/cmTestConfigureEscape.h ESCAPE_QUOTES)
+
 #
 # Create the libs and the main exe
 #

+ 13 - 0
Tests/Complex/Executable/complex.cxx

@@ -1,4 +1,5 @@
 #include "cmTestConfigure.h"
+#include "cmTestConfigureEscape.h"
 #include "cmVersion.h"
 #include "ExtraSources/file1.h"
 #include "file2.h"
@@ -678,6 +679,18 @@ int main()
     {
     cmFailed("SEPARATE_ARGUMENTS is not working");
     }
+  
+  // ----------------------------------------------------------------------
+  // Test Escape Quotes
+  if(strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0)
+    {
+    cmPassed("ESCAPE_QUOTES is working");
+    }
+  else
+    {
+    cmFailed("ESCAPE_QUOTES is not working");
+    }
+    
   // ----------------------------------------------------------------------
   // Summary
 

+ 1 - 0
Tests/Complex/cmTestConfigureEscape.h.in

@@ -0,0 +1 @@
+#define STRING_WITH_QUOTES "${STRING_WITH_QUOTES}"

+ 6 - 0
Tests/ComplexOneConfig/CMakeLists.txt

@@ -156,6 +156,12 @@ CONFIGURE_FILE(
   ${Complex_SOURCE_DIR}/cmTestConfigure.h.in
   ${Complex_BINARY_DIR}/cmTestConfigure.h)
 
+SET(STRING_WITH_QUOTES "\"hello world\"")
+# test CONFIGURE_FILE with ESCAPE_QUOTES on
+CONFIGURE_FILE(
+  ${Complex_SOURCE_DIR}/cmTestConfigureEscape.h.in
+  ${Complex_BINARY_DIR}/cmTestConfigureEscape.h ESCAPE_QUOTES)
+
 #
 # Create the libs and the main exe
 #

+ 13 - 0
Tests/ComplexOneConfig/Executable/complex.cxx

@@ -1,4 +1,5 @@
 #include "cmTestConfigure.h"
+#include "cmTestConfigureEscape.h"
 #include "cmVersion.h"
 #include "ExtraSources/file1.h"
 #include "file2.h"
@@ -678,6 +679,18 @@ int main()
     {
     cmFailed("SEPARATE_ARGUMENTS is not working");
     }
+  
+  // ----------------------------------------------------------------------
+  // Test Escape Quotes
+  if(strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0)
+    {
+    cmPassed("ESCAPE_QUOTES is working");
+    }
+  else
+    {
+    cmFailed("ESCAPE_QUOTES is not working");
+    }
+    
   // ----------------------------------------------------------------------
   // Summary
 

+ 1 - 0
Tests/ComplexOneConfig/cmTestConfigureEscape.h.in

@@ -0,0 +1 @@
+#define STRING_WITH_QUOTES "${STRING_WITH_QUOTES}"

+ 6 - 0
Tests/ComplexRelativePaths/CMakeLists.txt

@@ -156,6 +156,12 @@ CONFIGURE_FILE(
   ${Complex_SOURCE_DIR}/cmTestConfigure.h.in
   ${Complex_BINARY_DIR}/cmTestConfigure.h)
 
+SET(STRING_WITH_QUOTES "\"hello world\"")
+# test CONFIGURE_FILE with ESCAPE_QUOTES on
+CONFIGURE_FILE(
+  ${Complex_SOURCE_DIR}/cmTestConfigureEscape.h.in
+  ${Complex_BINARY_DIR}/cmTestConfigureEscape.h ESCAPE_QUOTES)
+
 #
 # Create the libs and the main exe
 #

+ 13 - 0
Tests/ComplexRelativePaths/Executable/complex.cxx

@@ -1,4 +1,5 @@
 #include "cmTestConfigure.h"
+#include "cmTestConfigureEscape.h"
 #include "cmVersion.h"
 #include "ExtraSources/file1.h"
 #include "file2.h"
@@ -678,6 +679,18 @@ int main()
     {
     cmFailed("SEPARATE_ARGUMENTS is not working");
     }
+  
+  // ----------------------------------------------------------------------
+  // Test Escape Quotes
+  if(strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0)
+    {
+    cmPassed("ESCAPE_QUOTES is working");
+    }
+  else
+    {
+    cmFailed("ESCAPE_QUOTES is not working");
+    }
+    
   // ----------------------------------------------------------------------
   // Summary
 

+ 1 - 0
Tests/ComplexRelativePaths/cmTestConfigureEscape.h.in

@@ -0,0 +1 @@
+#define STRING_WITH_QUOTES "${STRING_WITH_QUOTES}"