Skip to content

Convert bools to lowercase for XML spec compliance - #271

Merged
jeffkl merged 4 commits into
jeffkl:mainfrom
MattKotsenas:bugfix/nuspec-parsing
Mar 7, 2024
Merged

jeffkl merged 4 commits into
jeffkl:mainfrom
MattKotsenas:bugfix/nuspec-parsing

Conversation

@MattKotsenas

Copy link
Copy Markdown
Contributor

bool.ToString() returns an uppercase "True" or "False", but XML is
case sensitive and specifies that bools should be lowercase (see
https://learn.microsoft.com/en-us/dotnet/api/system.boolean.tostring).

While the built-in NuspecReader handles this, tools like NuGet Package
Explorer do not. Update Package.WriteNuspec to emit lowercase
bools.

I also added a basic unit test to catch accidental regressions.

`bool.ToString()` returns an uppercase "True" or "False", but XML is
case sensitive and speicifes that bools should be lowercase (see
https://learn.microsoft.com/en-us/dotnet/api/system.boolean.tostring).

While the built-in NuspecReader handles this, tools like NuGet Package
Explorer to not. Update the nuspec writer in Package to emit lowercase
bools, and update unit test to catch accidental regressions.
@MattKotsenas
MattKotsenas force-pushed the bugfix/nuspec-parsing branch from e61d184 to 5c9d62e Compare March 7, 2024 18:45

@jeffkl jeffkl left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@jeffkl
jeffkl enabled auto-merge (squash) March 7, 2024 18:55
@MattKotsenas

Copy link
Copy Markdown
Contributor Author

whoops! directory separator issues; taking a look...

@jeffkl

jeffkl commented Mar 7, 2024

Copy link
Copy Markdown
Owner

whoops! directory separator issues; taking a look...

There's an overload to .ShouldBe(string) that takes an option to ignore line breaks or something.

auto-merge was automatically disabled March 7, 2024 19:29

Head branch was pushed to by a user without write access

@MattKotsenas

Copy link
Copy Markdown
Contributor Author

whoops! directory separator issues; taking a look...

There's an overload to .ShouldBe(string) that takes an option to ignore line breaks or something.

Thanks! I needed to both use that to normalize \n vs \r\n, and had to parameterize the expected string with Path.DirectorySeparatorChar. Let me know if anything looks out-of-place, or if there's a better way to accomplish the same thing. Thanks!

@jeffkl
jeffkl merged commit 8b57afd into jeffkl:main Mar 7, 2024
@MattKotsenas
MattKotsenas deleted the bugfix/nuspec-parsing branch March 7, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants