mirror of
https://github.com/astaxie/beego.git
synced 2025-07-10 02:40:17 +00:00
fix:utils.GetGOPATHs() when go version equal or after go1.10 func does not return defaultGoPATH()
This commit is contained in:
36
utils/utils_test.go
Normal file
36
utils/utils_test.go
Normal file
@ -0,0 +1,36 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCompareGoVersion(t *testing.T) {
|
||||
targetVersion := "go1.8"
|
||||
if compareGoVersion("go1.12.4", targetVersion) != 1 {
|
||||
t.Error("should be 1")
|
||||
}
|
||||
|
||||
if compareGoVersion("go1.8.7", targetVersion) != 1 {
|
||||
t.Error("should be 1")
|
||||
}
|
||||
|
||||
if compareGoVersion("go1.8", targetVersion) != 0 {
|
||||
t.Error("should be 0")
|
||||
}
|
||||
|
||||
if compareGoVersion("go1.7.6", targetVersion) != -1 {
|
||||
t.Error("should be -1")
|
||||
}
|
||||
|
||||
if compareGoVersion("go1.12.1rc1", targetVersion) != 1 {
|
||||
t.Error("should be 1")
|
||||
}
|
||||
|
||||
if compareGoVersion("go1.8rc1", targetVersion) != 0 {
|
||||
t.Error("should be 0")
|
||||
}
|
||||
|
||||
if compareGoVersion("go1.7rc1", targetVersion) != -1 {
|
||||
t.Error("should be -1")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user