summaryrefslogtreecommitdiffstats
path: root/modules/templates/util_string_test.go
blob: 5844cf201d17896083bdf284c80ad3b969516507 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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"))
}