mirror of https://github.com/mickael-menu/zk
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.
18 lines
397 B
Go
18 lines
397 B
Go
package sqlite
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mickael-menu/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\\`)
|
|
}
|