mirror of
https://github.com/mickael-menu/zk
synced 2024-11-17 09:25:44 +00:00
50855154e2
* Move everything under the internal package. * Better separation between core and adapter packages, for easier unit testing. * Simplify data models. * Support multiple opened notebooks during runtime (useful for the LSP server). * Proper surface API which might be exposed later as a public Go package.
33 lines
766 B
Go
33 lines
766 B
Go
package icu
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mickael-menu/zk/internal/util/test/assert"
|
|
)
|
|
|
|
func TestEscapePAttern(t *testing.T) {
|
|
tests := map[string]string{
|
|
`foo bar`: `foo bar`,
|
|
`\a`: `\\a`,
|
|
`.`: `\.`,
|
|
`^`: `\^`,
|
|
`$`: `\$`,
|
|
`(`: `\(`,
|
|
`)`: `\)`,
|
|
`[`: `\[`,
|
|
`]`: `\]`,
|
|
`{`: `\{`,
|
|
`}`: `\}`,
|
|
`|`: `\|`,
|
|
`*`: `\*`,
|
|
`+`: `\+`,
|
|
`?`: `\?`,
|
|
`(?:[A-Za-z0-9]+[._]?){1,}[A-Za-z0-9]+\@(?:(?:[A-Za-z0-9]+[-]?){1,}[A-Za-z0-9]+\.){1,}`: `\(\?:\[A-Za-z0-9\]\+\[\._\]\?\)\{1,\}\[A-Za-z0-9\]\+\\@\(\?:\(\?:\[A-Za-z0-9\]\+\[-\]\?\)\{1,\}\[A-Za-z0-9\]\+\\\.\)\{1,\}`,
|
|
}
|
|
|
|
for input, expected := range tests {
|
|
assert.Equal(t, EscapePattern(input), expected)
|
|
}
|
|
}
|