diff --git a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs
index 77ca4c232d..dbc30675e6 100644
--- a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs
+++ b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs
@@ -307,6 +307,100 @@ protected override string GetNuspecContent()
}
}
+ [Categories.SemVer20]
+ public class when_packaging_with_four_part_version_with_trailing_zero : ScenariosBase
+ {
+ private string _originalVersion = "0.1.0.0";
+ protected override string ExpectedNuspecVersion => "0.1.0";
+ protected override string ExpectedSubDirectory => "PackageOutput";
+
+ public override void Because()
+ {
+ MockLogger.reset();
+ Service.pack_run(Configuration);
+ }
+
+ protected override string GetNuspecContent()
+ {
+ return NuspecContentWithFormatableVersion.format_with(_originalVersion);
+ }
+ }
+
+ [Categories.SemVer20]
+ public class when_packaging_with_leading_zeros_four_part : ScenariosBase
+ {
+ private string _originalVersion = "01.02.03.04";
+ protected override string ExpectedNuspecVersion => "1.2.3.4";
+ protected override string ExpectedSubDirectory => "PackageOutput";
+
+ public override void Because()
+ {
+ MockLogger.reset();
+ Service.pack_run(Configuration);
+ }
+
+ protected override string GetNuspecContent()
+ {
+ return NuspecContentWithFormatableVersion.format_with(_originalVersion);
+ }
+ }
+
+ public class when_packaging_with_leading_zeros_three_part : ScenariosBase
+ {
+ private string _originalVersion = "01.02.04";
+ protected override string ExpectedNuspecVersion => "1.2.4";
+ protected override string ExpectedSubDirectory => "PackageOutput";
+
+ public override void Because()
+ {
+ MockLogger.reset();
+ Service.pack_run(Configuration);
+ }
+
+ protected override string GetNuspecContent()
+ {
+ return NuspecContentWithFormatableVersion.format_with(_originalVersion);
+ }
+ }
+
+ [Categories.SemVer20]
+ public class when_packaging_with_leading_zeros_two_part : ScenariosBase
+ {
+ private string _originalVersion = "01.02";
+ protected override string ExpectedNuspecVersion => "1.2.0";
+ protected override string ExpectedSubDirectory => "PackageOutput";
+
+ public override void Because()
+ {
+ MockLogger.reset();
+ Service.pack_run(Configuration);
+ }
+
+ protected override string GetNuspecContent()
+ {
+ return NuspecContentWithFormatableVersion.format_with(_originalVersion);
+ }
+ }
+
+ [Categories.SemVer20]
+ public class when_packaging_with_multiple_leading_zeros : ScenariosBase
+ {
+ private string _originalVersion = "0001.0002.0003";
+ protected override string ExpectedNuspecVersion => "1.2.3";
+ protected override string ExpectedSubDirectory => "PackageOutput";
+
+ public override void Because()
+ {
+ MockLogger.reset();
+ Service.pack_run(Configuration);
+ }
+
+ protected override string GetNuspecContent()
+ {
+ return NuspecContentWithFormatableVersion.format_with(_originalVersion);
+ }
+ }
+
public class when_packing_with_properties : ScenariosBase
{
protected override string ExpectedNuspecVersion => "0.1.0";
@@ -758,5 +852,28 @@ public void should_throw_exception_on_icon_element()
";
+
+ private const string NuspecContentWithFormatableVersion = @"
+
+
+ test-package
+ Test Package
+ {0}
+ package author
+ package owner
+ A brief summary
+ A big description
+ test admin
+
+ http://apache.org/2
+ false
+
+
+
+
+
+
+
+";
}
}