1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-19 19:43:23 +08:00

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
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}") set(RunCMake_TEST_FAILED "No nuspec file generated under ${RunCMake_TEST_BINARY_DIR}")
else() else()
# Read in the generated nuspec file content # 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 # 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 # Compare the file contents
string(COMPARE EQUAL "${actual_nuspec}" "${expected_nuspec}" nuspec_matches) string(COMPARE EQUAL "${actual_nuspec}" "${expected_nuspec}" nuspec_matches)

View File

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