PLT-1765 allowing support of 2 previous versions

Этот коммит содержится в:
=Corey Hulen
2016-01-28 11:39:48 -05:00
родитель fa6daad64d
Коммит 2138b46f6c
5 изменённых файлов: 93 добавлений и 50 удалений

Просмотреть файл

@@ -36,20 +36,28 @@ func TestSplitVersion(t *testing.T) {
}
func TestGetPreviousVersion(t *testing.T) {
if major, minor := GetPreviousVersion("1.0.0"); major != 0 || minor != 7 {
t.Fatal(major, minor)
if GetPreviousVersion("1.3.0") != "1.2.0" {
t.Fatal()
}
if major, minor := GetPreviousVersion("0.7.0"); major != 0 || minor != 6 {
t.Fatal(major, minor)
if GetPreviousVersion("1.2.1") != "1.1.0" {
t.Fatal()
}
if major, minor := GetPreviousVersion("0.7.1"); major != 0 || minor != 6 {
t.Fatal(major, minor)
if GetPreviousVersion("1.1.0") != "1.0.0" {
t.Fatal()
}
if major, minor := GetPreviousVersion("0.7111.1"); major != 0 || minor != 0 {
t.Fatal(major, minor)
if GetPreviousVersion("1.0.0") != "0.7.0" {
t.Fatal()
}
if GetPreviousVersion("0.7.1") != "0.6.0" {
t.Fatal()
}
if GetPreviousVersion("0.5.0") != "" {
t.Fatal()
}
}
@@ -72,3 +80,31 @@ func TestIsCurrentVersion(t *testing.T) {
t.Fatal()
}
}
func TestIsPreviousVersionsSupported(t *testing.T) {
// 1.4.0 CURRENT RELEASED VERSION
if !IsPreviousVersionsSupported(versions[0]) {
t.Fatal()
}
// 1.3.0
if !IsPreviousVersionsSupported(versions[1]) {
t.Fatal()
}
// 1.2.1
if !IsPreviousVersionsSupported(versions[2]) {
t.Fatal()
}
// 1.2.0
if !IsPreviousVersionsSupported(versions[3]) {
t.Fatal()
}
// 1.1.0 NOT SUPPORTED
if IsPreviousVersionsSupported(versions[4]) {
t.Fatal()
}
}