aboutsummaryrefslogtreecommitdiff
path: root/common_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-05-17 03:49:02 +0700
committerShulhan <ms@kilabit.info>2018-05-17 03:49:02 +0700
commitfb989eced7d80da08973f04a561464f54a5f08d8 (patch)
treefacb34dcb0c54829f54317314502ccd8369aca4a /common_test.go
parentf089e57911b102c3ef94184a8ef32f457b940eb4 (diff)
downloadbeku-fb989eced7d80da08973f04a561464f54a5f08d8.tar.xz
Move Package.IsTag to common.IsTagVersion and add unit test for it
Diffstat (limited to 'common_test.go')
-rw-r--r--common_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/common_test.go b/common_test.go
index 9f2950c..f504b47 100644
--- a/common_test.go
+++ b/common_test.go
@@ -55,6 +55,41 @@ func TestIsIgnoredDir(t *testing.T) {
}
}
+func TestIsTagVersion(t *testing.T) {
+ cases := []struct {
+ ver string
+ exp bool
+ }{{
+ ver: "",
+ }, {
+ ver: " v",
+ }, {
+ ver: "v1",
+ exp: true,
+ }, {
+ ver: "1",
+ exp: false,
+ }, {
+ ver: "1.0",
+ exp: true,
+ }, {
+ ver: "alpha",
+ exp: false,
+ }, {
+ ver: "abcdef1",
+ exp: false,
+ }}
+
+ var got bool
+ for _, c := range cases {
+ t.Log(c)
+
+ got = IsTagVersion(c.ver)
+
+ test.Assert(t, "", c.exp, got, true)
+ }
+}
+
func TestConfirm(t *testing.T) {
cases := []struct {
defIsYes bool