Skip to content

Commit 4365153

Browse files
committed
Upgrade: adding test around version perfixed with 'v'
1 parent 88827e6 commit 4365153

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

config/upgrade_test.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func TestSemverUpgradeOrNot(t *testing.T) {
8787
t.Fatalf("(revert) %s -> %s, got %t, want %t", tc.latest, tc.current, got, want)
8888
}
8989

90-
// with 'v' prefix
90+
// with both 'v' prefix
9191
current := "v" + tc.current
9292
latest := "v" + tc.latest
9393

@@ -97,5 +97,27 @@ func TestSemverUpgradeOrNot(t *testing.T) {
9797
if got, want := isSemverUpgrade(latest, current), tc.revert; got != want {
9898
t.Fatalf("(revert) %s -> %s, got %t, want %t", latest, current, got, want)
9999
}
100+
101+
// with current 'v' prefix
102+
current = "v" + tc.current
103+
latest = tc.latest
104+
105+
if got, want := isSemverUpgrade(current, latest), tc.exp; got != want {
106+
t.Fatalf("%s -> %s, got %t, want %t", current, latest, got, want)
107+
}
108+
if got, want := isSemverUpgrade(latest, current), tc.revert; got != want {
109+
t.Fatalf("(revert) %s -> %s, got %t, want %t", latest, current, got, want)
110+
}
111+
112+
// with latest 'v' prefix
113+
current = tc.current
114+
latest = "v" + tc.latest
115+
116+
if got, want := isSemverUpgrade(current, latest), tc.exp; got != want {
117+
t.Fatalf("%s -> %s, got %t, want %t", current, latest, got, want)
118+
}
119+
if got, want := isSemverUpgrade(latest, current), tc.revert; got != want {
120+
t.Fatalf("(revert) %s -> %s, got %t, want %t", latest, current, got, want)
121+
}
100122
}
101123
}

0 commit comments

Comments
 (0)