internal/godoc/dochtml: add test for package in same module

Verify that links to packages in the same module are versioned.

Change-Id: I31394b6cb15d58a842691cee8887f2d8d5a02cf2
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/414394
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/internal/godoc/dochtml/dochtml_test.go b/internal/godoc/dochtml/dochtml_test.go
index cf32617..b563e1c 100644
--- a/internal/godoc/dochtml/dochtml_test.go
+++ b/internal/godoc/dochtml/dochtml_test.go
@@ -37,6 +37,11 @@
 	FileLinkFunc:     func(string) string { return "file" },
 	SourceLinkFunc:   func(ast.Node) string { return "src" },
 	SinceVersionFunc: func(string) string { return "" },
+	ModInfo: &ModuleInfo{
+		ModulePath:      "example.com/module",
+		ResolvedVersion: "v1.2.3",
+		ModulePackages:  map[string]bool{"example.com/module/pkg": true},
+	},
 }
 
 func TestCheckTemplates(t *testing.T) {
diff --git a/internal/godoc/dochtml/testdata/comments.go b/internal/godoc/dochtml/testdata/comments.go
index d0bb600..02e8042 100644
--- a/internal/godoc/dochtml/testdata/comments.go
+++ b/internal/godoc/dochtml/testdata/comments.go
@@ -35,6 +35,9 @@
 // A numbered list looks like
 //  1. a
 //  2. b
+//
+// This link refers to a package in the same
+// module: [example.com/module/pkg].
 type T struct{}
 
 // M refers to [F].
diff --git a/internal/godoc/dochtml/testdata/comments.golden b/internal/godoc/dochtml/testdata/comments.golden
index b21a979..574aeb5 100644
--- a/internal/godoc/dochtml/testdata/comments.golden
+++ b/internal/godoc/dochtml/testdata/comments.golden
@@ -73,7 +73,9 @@
 </p><ol class="Documentation-numberList">
 <li value="1">a</li>
 <li value="2">b</li>
-</ol>
+</ol><p>This link refers to a package in the same
+module: <a href="/example.com/module@v1.2.3/pkg">example.com/module/pkg</a>.
+</p>
 <div class="Documentation-typeMethod">
 <h4 tabindex="-1" id="T.M" data-kind="method" class="Documentation-typeMethodHeader">
 <span>func (T) <a class="Documentation-source" href="src">M</a> <a class="Documentation-idLink" href="#T.M">¶</a></span>