Skip to content

Commit f0e2983

Browse files
committed
Add ZeroFormatting tests to cover zero-suppression syntax
1 parent 625c32f commit f0e2983

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/GitVersion.Core.Tests/Formatting/FormattableFormatterTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,16 @@ public void TryFormat_UnsupportedFormat_ReturnsFalse(object input, string format
3939
result.ShouldBeFalse();
4040
formatted.ShouldBe(expected);
4141
}
42+
43+
[TestCase(0, "0000", "0000")]
44+
[TestCase(1, "0000", "0001")]
45+
[TestCase(0, "-0000;;''", "")]
46+
[TestCase(1, "-0000;;''", "-0001")]
47+
public void ZeroFormatting(int value, string format, string expected)
48+
{
49+
var sut = new FormattableFormatter();
50+
var result = sut.TryFormat(value, format, out var formatted);
51+
result.ShouldBe(true);
52+
formatted.ShouldBe(expected);
53+
}
4254
}

0 commit comments

Comments
 (0)