mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-20 16:55:35 +00:00
Run `go fix ./...` and keep mechanical modernization updates.
- Replace `interface{}` with `any` in signatures and local types
- Apply formatter/style cleanups from go1.26 tooling
- Keep `omitempty` behavior-preserving simplifications suggested by fix
- No functional feature changes intended
Validation:
- go test ./... -run '^$' -count=1 (Go 1.26.0)
- GOTOOLCHAIN=go1.24.10 go test ./... -run '^$' -count=1
Signed-off-by: Michael Mayer <michael@photoprism.app>
41 lines
637 B
Go
41 lines
637 B
Go
package status
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/photoprism/photoprism/pkg/clean"
|
|
)
|
|
|
|
func TestError(t *testing.T) {
|
|
t.Helper()
|
|
|
|
tests := []struct {
|
|
name string
|
|
err error
|
|
}{
|
|
{
|
|
name: "Nil",
|
|
err: nil,
|
|
},
|
|
{
|
|
name: "SanitizeSpecialCharacters",
|
|
err: errors.New("permission denied { DROP TABLE users; }"),
|
|
},
|
|
{
|
|
name: "WhitespaceOnly",
|
|
err: errors.New(" "),
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
if got, want := Error(tt.err), clean.Error(tt.err); got != want {
|
|
t.Fatalf("Error(%v) = %q, want %q", tt.err, got, want)
|
|
}
|
|
})
|
|
}
|
|
}
|