Skip to content

Commit 0c3e0c0

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

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,15 @@ public void TryFormat_UnsupportedFormat_ReturnsFalse()
3535
result.ShouldBeFalse();
3636
formatted.ShouldBeEmpty();
3737
}
38+
39+
[TestCase(0, "{0:0000}", "0000")]
40+
[TestCase(1, "{0:0000}", "0001")]
41+
[TestCase(0, "{0:-0000;;''}", "")]
42+
[TestCase(1, "{0:-0000;;''}", "-0001")]
43+
public void ZeroFormatting(int value, string template, string expected)
44+
{
45+
var candidate = string.Format(template, value);
46+
47+
Assert.That(candidate, Is.EqualTo(expected));
48+
}
3849
}

0 commit comments

Comments
 (0)