Skip to content

Commit 945542f

Browse files
committed
Test version string
1 parent 4064d1b commit 945542f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

govarnamgo/govarnamgo_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import (
44
"io/ioutil"
55
"log"
66
"os"
7+
"os/exec"
78
"reflect"
89
"runtime/debug"
10+
"strings"
911
"sync"
1012
"testing"
1113
)
@@ -54,6 +56,16 @@ func getVarnamInstance(schemeID string) *VarnamHandle {
5456
return nil
5557
}
5658

59+
func TestVersion(t *testing.T) {
60+
cmd := "echo $(git describe --abbrev=0 --tags || echo 'latest') | sed s/v//"
61+
cmdRun, buff := exec.Command("bash", "-c", cmd), new(strings.Builder)
62+
cmdRun.Stdout = buff
63+
cmdRun.Run()
64+
tagVersion := strings.TrimRight(buff.String(), "\n")
65+
66+
assertEqual(t, GetVersion(), tagVersion)
67+
}
68+
5769
func tearDown() {
5870
os.RemoveAll(testTempDir)
5971
}

0 commit comments

Comments
 (0)