mirror of
https://github.com/lukaszraczylo/semver-generator.git
synced 2026-06-28 03:03:06 +00:00
Add strict matching which disables automatic incrementation of the patch until the trigger word is found.
This commit is contained in:
+43
-3
@@ -332,9 +332,10 @@ func (suite *Tests) TestSetup_CalculateSemver() {
|
||||
Patch int
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
fields fields
|
||||
wantSemver wantSemver
|
||||
name string
|
||||
fields fields
|
||||
wantSemver wantSemver
|
||||
strictMatching bool
|
||||
}{
|
||||
{
|
||||
name: "Test on existing repository",
|
||||
@@ -351,6 +352,22 @@ func (suite *Tests) TestSetup_CalculateSemver() {
|
||||
Patch: 7,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Test on existing repository with strict matching",
|
||||
fields: fields{
|
||||
RepositoryName: "https://github.com/lukaszraczylo/semver-generator-test-repo",
|
||||
LocalConfigFile: "meta.yaml",
|
||||
Force: Force{
|
||||
Commit: "",
|
||||
},
|
||||
},
|
||||
strictMatching: true,
|
||||
wantSemver: wantSemver{
|
||||
Major: 2,
|
||||
Minor: 4,
|
||||
Patch: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Test on existing repository, starting with certain hash",
|
||||
fields: fields{
|
||||
@@ -387,6 +404,7 @@ func (suite *Tests) TestSetup_CalculateSemver() {
|
||||
s.ForcedVersioning()
|
||||
s.Force = tt.fields.Force
|
||||
s.ListCommits()
|
||||
varStrict = tt.strictMatching
|
||||
semver := s.CalculateSemver()
|
||||
assert.Equal(tt.wantSemver.Major, semver.Major, "Unexpected MAJOR semver result in "+tt.name)
|
||||
assert.Equal(tt.wantSemver.Minor, semver.Minor, "Unexpected MINOR semver result in "+tt.name)
|
||||
@@ -394,3 +412,25 @@ func (suite *Tests) TestSetup_CalculateSemver() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *Tests) Test_debugPrint() {
|
||||
type args struct {
|
||||
content string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
}{
|
||||
{
|
||||
name: "Test debug print",
|
||||
args: args{
|
||||
content: "Test debug",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
suite.T().Run(tt.name, func(t *testing.T) {
|
||||
debugPrint(tt.args.content)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user