mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
28 lines
485 B
Go
28 lines
485 B
Go
|
//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(``))
|
||
|
}
|