Files
fn-serverless/fnctl/bump_test.go
C Cirello a4d44798dd fnctl: improve bump call and link version to the publish process (#267)
* fnctl: improve bump call and link version to the publish process

* fnctl: update README.md with latest changes for bump command
2016-11-11 17:44:16 +01:00

30 lines
849 B
Go

package main
import "testing"
func TestImageversion(t *testing.T) {
type args struct {
image string
}
tests := []struct {
name string
args args
wantName string
wantVer string
}{
{"tag absent", args{"owner/imagename"}, "owner/imagename", initialVersion},
{"non semver tag", args{"owner/imagename:tag"}, "owner/imagename", ""},
{"semver tag (M.m.p)", args{"owner/imagename:0.0.1"}, "owner/imagename", "0.0.1"},
{"semver tag (vM.m.p)", args{"owner/imagename:v0.0.1"}, "owner/imagename", "0.0.1"},
}
for _, tt := range tests {
gotName, gotVer := imageversion(tt.args.image)
if gotName != tt.wantName {
t.Errorf("%q. imageversion() gotName = %v, want %v", tt.name, gotName, tt.wantName)
}
if gotVer != tt.wantVer {
t.Errorf("%q. imageversion() gotVer = %v, want %v", tt.name, gotVer, tt.wantVer)
}
}
}