mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-27 17:28:33 +01:00
c021a5b919
Refactor locale&string&template related code has .Title be template.HTML and "Improve HTML title on repositories" needs to check the prefix with StringUtils.HasPrefix
20 lines
495 B
Go
20 lines
495 B
Go
// Copyright Earl Warren <contact@earl-warren.org>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package templates
|
|
|
|
import (
|
|
"html/template"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_StringUtils_HasPrefix(t *testing.T) {
|
|
su := &StringUtils{}
|
|
assert.True(t, su.HasPrefix("ABC", "A"))
|
|
assert.False(t, su.HasPrefix("ABC", "B"))
|
|
assert.True(t, su.HasPrefix(template.HTML("ABC"), "A"))
|
|
assert.False(t, su.HasPrefix(template.HTML("ABC"), "B"))
|
|
assert.False(t, su.HasPrefix(123, "B"))
|
|
}
|