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

This commit is contained in:
Alex Turbov 2025-01-04 20:38:00 +04:00
parent 3c4b9cd979
commit 74e0173f66
No known key found for this signature in database
GPG Key ID: 8BEDB7D11F95D5E3
3 changed files with 2 additions and 17 deletions

View File

@ -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

View File

@ -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)

View File

@ -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>