(t *testing.T)
| 163 | } |
| 164 | |
| 165 | func TestBaseVersion(t *testing.T) { |
| 166 | tests := []struct { |
| 167 | input, expected string |
| 168 | }{ |
| 169 | {"v0.4.0-61-gd06835b", "0.4.0"}, |
| 170 | {"0.4.0-61-gd06835b", "0.4.0"}, |
| 171 | {"v0.5.0", "0.5.0"}, |
| 172 | {"0.5.0", "0.5.0"}, |
| 173 | {"1.0.0-beta", "1.0.0-beta"}, |
| 174 | {"1.0.0-beta-3-gabcdef1", "1.0.0-beta"}, |
| 175 | {"dev", "dev"}, |
| 176 | {"v0.4.0-dirty", "0.4.0"}, |
| 177 | {"0.4.0-81-g1d1ebf3-dirty", "0.4.0"}, |
| 178 | } |
| 179 | |
| 180 | for _, tc := range tests { |
| 181 | result := baseVersion(tc.input) |
| 182 | if result != tc.expected { |
| 183 | t.Errorf("baseVersion(%q) = %q, want %q", tc.input, result, tc.expected) |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | func TestCompareVersions(t *testing.T) { |
| 189 | tests := []struct { |
nothing calls this directly
no test coverage detected