package tool_test import ( "testing" "code.icb4dc0.de/buildr/golang-plugin/tool" ) func TestGoTool_BinaryName(t *testing.T) { t.Parallel() type fields struct { BinaryNameOverride string Repository string Version string } tests := []struct { name string fields fields want string }{ { name: "Override", fields: fields{ BinaryNameOverride: "go-buildr", Repository: "code.icb4dc0.de/buildr/buildr", }, want: "go-buildr", }, { name: "No override, no inline-version, no version suffix", fields: fields{ Repository: "code.icb4dc0.de/buildr/buildr", }, want: "buildr", }, { name: "No override, no inline-version, version suffix", fields: fields{ Repository: "code.icb4dc0.de/buildr/buildr/v2", }, want: "buildr", }, { name: "No override, inline-version, no version suffix", fields: fields{ Repository: "code.icb4dc0.de/buildr/buildr@latest", }, want: "buildr", }, { name: "No override, inline-version, version suffix", fields: fields{ Repository: "code.icb4dc0.de/buildr/buildr/v2@latest", }, want: "buildr", }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() g := tool.GoTool{ BinaryNameOverride: tt.fields.BinaryNameOverride, Repository: tt.fields.Repository, Version: tt.fields.Version, } if got := g.BinaryName(); got != tt.want { t.Errorf("BinaryName() = %v, want %v", got, tt.want) } }) } }