Pārlūkot izejas kodu

Tests(NuGet): Fix the test to ignore empty and space-only lines

Alex Turbov 9 mēneši atpakaļ
vecāks
revīzija
74e0173f66

+ 0 - 3
Tests/RunCMake/CPack_NuGet/.gitattributes

@@ -1,3 +0,0 @@
-# Do not check whitespace in the nuspec file for comparison. It needs to
-# look identical to the file generated in the test.
-expected.nuspec  -whitespace

+ 2 - 2
Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake

@@ -3,9 +3,9 @@ if(NOT generated_nuspec)
   set(RunCMake_TEST_FAILED "No nuspec file generated under ${RunCMake_TEST_BINARY_DIR}")
 else()
   # Read in the generated nuspec file content
-  file(READ "${generated_nuspec}" actual_nuspec)
+  file(STRINGS "${generated_nuspec}" actual_nuspec REGEX "^.*[^ ]+$")
   # Read in the expected file content
-  file(READ "${CMAKE_CURRENT_LIST_DIR}/expected.nuspec" expected_nuspec)
+  file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/expected.nuspec" expected_nuspec REGEX "^.*[^ ]+$")
 
   # Compare the file contents
   string(COMPARE EQUAL "${actual_nuspec}" "${expected_nuspec}" nuspec_matches)

+ 0 - 12
Tests/RunCMake/CPack_NuGet/expected.nuspec

@@ -6,22 +6,11 @@
         <version>1.2.3</version>
         <description><![CDATA[A NuGet package for testing CMake's CPack NuGet generator]]></description>
         <authors><![CDATA[ACME Inc]]></authors>
-
         <!-- Optional elements -->
-        
         <owners><![CDATA[ACME Inc]]></owners>
         <projectUrl><![CDATA[https://www.example.com]]></projectUrl>
-        
         <license type="expression"><![CDATA[MIT]]></license>
-        
-        
-        
-        
         <summary><![CDATA[A test NuGet package]]></summary>
-        
-        
-        
-        
         <repository type="git" url="https://github.com/example/nugetlib.git" />
         <dependencies>
             <group>
@@ -34,5 +23,4 @@
             <group targetFramework="net6.0" />
         </dependencies>
     </metadata>
-    
 </package>