@@ -21,6 +21,7 @@ func TestStrictNewVersion(t *testing.T) {
2121		{"v1.0" , true },
2222		{"1" , true },
2323		{"v1" , true },
24+ 		{"1.2" , true },
2425		{"1.2.beta" , true },
2526		{"v1.2.beta" , true },
2627		{"foo" , true },
@@ -45,6 +46,25 @@ func TestStrictNewVersion(t *testing.T) {
4546		// The SemVer spec in a pre-release expects to allow [0-9A-Za-z-]. But, 
4647		// the lack of all 3 parts in this version should produce an error. 
4748		{"20221209-update-renovatejson-v4" , true },
49+ 
50+ 		// Various cases that are invalid semver 
51+ 		{"1.1.2+.123" , true },                             // A leading . in build metadata. This would signify that the first segment is empty 
52+ 		{"1.0.0-alpha_beta" , true },                       // An underscore in the pre-release is an invalid character 
53+ 		{"1.0.0-alpha.." , true },                          // Multiple empty segments 
54+ 		{"1.0.0-alpha..1" , true },                         // Multiple empty segments but one with a value 
55+ 		{"01.1.1" , true },                                 // A leading 0 on a number segment 
56+ 		{"1.01.1" , true },                                 // A leading 0 on a number segment 
57+ 		{"1.1.01" , true },                                 // A leading 0 on a number segment 
58+ 		{"9.8.7+meta+meta" , true },                        // Multiple metadata parts 
59+ 		{"1.2.31----RC-SNAPSHOT.12.09.1--.12+788" , true }, // Leading 0 in a number part of a pre-release segment 
60+ 		{"1.2.3-0123" , true },
61+ 		{"1.2.3-0123.0123" , true },
62+ 		{"+invalid" , true },
63+ 		{"-invalid" , true },
64+ 		{"-invalid.01" , true },
65+ 		{"alpha+beta" , true },
66+ 		{"1.2.3-alpha_beta+foo" , true },
67+ 		{"1.0.0-alpha..1" , true },
4868	}
4969
5070	for  _ , tc  :=  range  tests  {
@@ -101,6 +121,17 @@ func TestNewVersion(t *testing.T) {
101121
102122		// The SemVer spec in a pre-release expects to allow [0-9A-Za-z-]. 
103123		{"20221209-update-renovatejson-v4" , false },
124+ 
125+ 		// Various cases that are invalid semver 
126+ 		{"1.1.2+.123" , true },                             // A leading . in build metadata. This would signify that the first segment is empty 
127+ 		{"1.0.0-alpha_beta" , true },                       // An underscore in the pre-release is an invalid character 
128+ 		{"1.0.0-alpha.." , true },                          // Multiple empty segments 
129+ 		{"1.0.0-alpha..1" , true },                         // Multiple empty segments but one with a value 
130+ 		{"01.1.1" , true },                                 // A leading 0 on a number segment 
131+ 		{"1.01.1" , true },                                 // A leading 0 on a number segment 
132+ 		{"1.1.01" , true },                                 // A leading 0 on a number segment 
133+ 		{"9.8.7+meta+meta" , true },                        // Multiple metadata parts 
134+ 		{"1.2.31----RC-SNAPSHOT.12.09.1--.12+788" , true }, // Leading 0 in a number part of a pre-release segment 
104135	}
105136
106137	for  _ , tc  :=  range  tests  {
0 commit comments