(t *testing.T)
| 186 | } |
| 187 | |
| 188 | func TestCompareVersions(t *testing.T) { |
| 189 | tests := []struct { |
| 190 | current, latest string |
| 191 | expected bool |
| 192 | }{ |
| 193 | {"0.5.0", "0.5.1", true}, |
| 194 | {"0.5.0", "0.5.0", false}, |
| 195 | {"v0.5.0", "v0.5.0", false}, |
| 196 | {"dev", "1.0.0", false}, |
| 197 | {"1.0.0", "2.0.0", true}, |
| 198 | // Dev builds ahead of a tag should not report update available |
| 199 | {"0.4.0-61-gd06835b", "0.4.0", false}, |
| 200 | {"v0.4.0-61-gd06835b", "v0.4.0", false}, |
| 201 | // Dev builds should report update when a newer release exists |
| 202 | {"0.4.0-61-gd06835b", "0.5.0", true}, |
| 203 | } |
| 204 | |
| 205 | for _, tc := range tests { |
| 206 | result := CompareVersions(tc.current, tc.latest) |
| 207 | if result != tc.expected { |
| 208 | t.Errorf("CompareVersions(%q, %q) = %v, want %v", tc.current, tc.latest, result, tc.expected) |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | func TestFindAssets(t *testing.T) { |
| 214 | assets := []Asset{ |
nothing calls this directly
no test coverage detected