| 1 | // Copyright 2022 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package semver |
| 6 | |
| 7 | import ( |
| 8 | "testing" |
| 9 | ) |
| 10 | |
| 11 | func TestCanonicalize(t *testing.T) { |
| 12 | for _, test := range []struct { |
| 13 | v string |
| 14 | want string |
| 15 | }{ |
| 16 | {"v1.2.3", "v1.2.3"}, |
| 17 | {"1.2.3", "v1.2.3"}, |
| 18 | {"go1.2.3", "v1.2.3"}, |
| 19 | } { |
| 20 | got := CanonicalizeSemverPrefix(test.v) |
| 21 | if got != test.want { |
| 22 | t.Errorf("want %s; got %s", test.want, got) |
| 23 | } |
| 24 | } |
| 25 | } |