aboutsummaryrefslogtreecommitdiff
path: root/gopls/internal/govulncheck/semver/semver_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'gopls/internal/govulncheck/semver/semver_test.go')
-rw-r--r--gopls/internal/govulncheck/semver/semver_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/gopls/internal/govulncheck/semver/semver_test.go b/gopls/internal/govulncheck/semver/semver_test.go
new file mode 100644
index 000000000..6daead685
--- /dev/null
+++ b/gopls/internal/govulncheck/semver/semver_test.go
@@ -0,0 +1,28 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build go1.18
+// +build go1.18
+
+package semver
+
+import (
+ "testing"
+)
+
+func TestCanonicalize(t *testing.T) {
+ for _, test := range []struct {
+ v string
+ want string
+ }{
+ {"v1.2.3", "v1.2.3"},
+ {"1.2.3", "v1.2.3"},
+ {"go1.2.3", "v1.2.3"},
+ } {
+ got := CanonicalizeSemverPrefix(test.v)
+ if got != test.want {
+ t.Errorf("want %s; got %s", test.want, got)
+ }
+ }
+}