golang.org/x/tools/gopls@v0.15.3/internal/vulncheck/semver/semver_test.go (about) 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 //go:build go1.18 6 // +build go1.18 7 8 package semver 9 10 import ( 11 "testing" 12 ) 13 14 func TestCanonicalize(t *testing.T) { 15 for _, test := range []struct { 16 v string 17 want string 18 }{ 19 {"v1.2.3", "v1.2.3"}, 20 {"1.2.3", "v1.2.3"}, 21 {"go1.2.3", "v1.2.3"}, 22 } { 23 got := CanonicalizeSemverPrefix(test.v) 24 if got != test.want { 25 t.Errorf("want %s; got %s", test.want, got) 26 } 27 } 28 }