Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add ZeroFormatting tests to cover zero-suppression syntax
  • Loading branch information
9swampy authored and arturcic committed Aug 9, 2025
commit dfd7ec0a93363afdd008e00f0bec6b8bad069206
12 changes: 12 additions & 0 deletions src/GitVersion.Core.Tests/Formatting/FormattableFormatterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,16 @@ public void TryFormat_UnsupportedFormat_ReturnsFalse(object input, string format
result.ShouldBeFalse();
formatted.ShouldBe(expected);
}

[TestCase(0, "0000", "0000")]
[TestCase(1, "0000", "0001")]
[TestCase(0, "-0000;;''", "")]
[TestCase(1, "-0000;;''", "-0001")]
public void ZeroFormatting(int value, string format, string expected)
{
var sut = new FormattableFormatter();
var result = sut.TryFormat(value, format, out var formatted);
result.ShouldBe(true);
formatted.ShouldBe(expected);
}
}