commit | 01024f74ad4879e69ed2749ac28c5e475b281577 | [log] [tgz] |
---|---|---|
author | Jonathan Amsterdam <jba@google.com> | Fri Sep 16 08:23:04 2022 -0400 |
committer | Jonathan Amsterdam <jba@google.com> | Tue Sep 20 22:52:45 2022 +0000 |
tree | aedba513ab270746d88f70702dfbb9e73944a8ff | |
parent | bc025134c83876a7a45f4c4037378bcbba191a98 [diff] |
internal/frontend: refactor serveSearch for testing Split serveSearch into two functions: one computes the action to take (redirect, serve a page or error) and the other carries out the action. This makes it much easier to test the search logic, since we don't have to examine HTML output, just the searchAction struct. Add a test that verifies much of the high-level search logic: various errors, when to redirect, etc. Change-Id: I56d31264fd511420c94961ed6de4e464ebafd27b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/431176 Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
Pkg.go.dev is a website for discovering and evaluating Go packages and modules.
You can check it out at https://pkg.go.dev.
Pkgsite requires Go 1.19 to run. The last commit that works with Go 1.18 is 9ffe8b928e4fbd3ff7dcf984254629a47f8b6e63. The last commit that works with Go 1.17 is 4d836c6a652cde92f433967680dfd6171a91ec12.
If you want to report a bug or have a feature suggestion, please first check the known issues to see if your issue is already being discussed. If an issue does not already exist, feel free to file an issue.
For answers to frequently asked questions, see pkg.go.dev/about.
You can also chat with us on the #pkgsite Slack channel on the Gophers Slack.
We would love your help!
Our canonical Git repository is located at go.googlesource.com/pkgsite. There is a mirror of the repository at github.com/golang/pkgsite.
To contribute, please read our contributing guide.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.