heuristics regexp engine configurable #2, skip rules at runtime

This commit is contained in:
Alex Bezzubov
2023-01-19 15:58:43 +01:00
parent d8913b00e9
commit 3aeb9879da
8 changed files with 141 additions and 38 deletions

27
regex/standard_test.go Normal file
View File

@ -0,0 +1,27 @@
//go:build !oniguruma
// +build !oniguruma
package regex
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMustCompileMultiline(t *testing.T) {
const re = `^\.(.*)!$`
want := MustCompileMultiline(re)
assert.Equal(t, "(?m)"+re, want.String())
const s = `.one
.two!
thre!`
if !want.MatchString(s) {
t.Fatalf("MustCompileMultiline(`%s`) must match multiline %q\n", re, s)
}
}
func TestMustCompileRuby(t *testing.T) {
assert.Nil(t, MustCompileRuby(``))
}