You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zk/internal/adapter/sqlite/util_test.go

18 lines
391 B
Go

package sqlite
import (
"testing"
"github.com/zk-org/zk/internal/util/test/assert"
)
func TestEscapeLikeTerm(t *testing.T) {
test := func(term string, escapeChar rune, expected string) {
assert.Equal(t, escapeLikeTerm(term, escapeChar), expected)
}
test("foo bar", '@', "foo bar")
test("foo%bar_with@", '@', "foo@%bar@_with@@")
test(`foo%bar_with\`, '\\', `foo\%bar\_with\\`)
}