test(version): cover the version function
This commit is contained in:
21
generator/version_test.go
Normal file
21
generator/version_test.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package generator
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestVersion(t *testing.T) {
|
||||||
|
// we build on "devel" branch
|
||||||
|
v := GetVersion()
|
||||||
|
if strings.Contains(v, "(devel)") {
|
||||||
|
t.Errorf("Expected version to be set, got %s", v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// now, imagine we are on a release branch
|
||||||
|
Version = "release-1.0.0"
|
||||||
|
v = GetVersion()
|
||||||
|
if !strings.Contains(v, "release-1.0.0") {
|
||||||
|
t.Errorf("Expected version to be set, got %s", v)
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user