changelog/service/service_test.go
jolheiser 70c955ae17
All checks were successful
goreleaser
Title-case PR title (#76)
Resolves #60

Extracts the previous trim into a new func as well to keep any title munging consistent.

Reviewed-on: #76
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io>
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2023-03-22 04:35:58 +08:00

39 lines
794 B
Go

// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package service
import (
"os"
"testing"
)
func TestMain(m *testing.M) {
os.Exit(m.Run())
}
func TestCleanTitle(t *testing.T) {
tt := []struct {
Title string
Expected string
}{
{Title: "foo", Expected: "Foo"},
{Title: " foo", Expected: "Foo"},
{Title: "foo bar", Expected: "Foo bar"},
{Title: "Foo bar", Expected: "Foo bar"},
{Title: " Foo bar ", Expected: "Foo bar"},
{Title: "1234", Expected: "1234"},
}
for _, tc := range tt {
t.Run(tc.Title, func(t *testing.T) {
s := CleanTitle(tc.Title)
if s != tc.Expected {
t.Logf("got %q | expected %q", s, tc.Expected)
t.Fail()
}
})
}
}