Tests(NuGet): Fix the test to ignore empty and space-only lines
diff --git a/Tests/RunCMake/CPack_NuGet/.gitattributes b/Tests/RunCMake/CPack_NuGet/.gitattributes
deleted file mode 100644
index 4a8bbd0..0000000
--- a/Tests/RunCMake/CPack_NuGet/.gitattributes
+++ /dev/null
@@ -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
diff --git a/Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake b/Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake
index e83f007..6e930b6 100644
--- a/Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake
+++ b/Tests/RunCMake/CPack_NuGet/NuGetLib-cpack-NuGet-check.cmake
@@ -3,9 +3,9 @@
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)
diff --git a/Tests/RunCMake/CPack_NuGet/expected.nuspec b/Tests/RunCMake/CPack_NuGet/expected.nuspec
index d5c6c45..3d96df0 100644
--- a/Tests/RunCMake/CPack_NuGet/expected.nuspec
+++ b/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>