mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
23 lines
419 B
Go
23 lines
419 B
Go
package llm
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"regexp"
|
|
"testing"
|
|
)
|
|
|
|
func TestRegex(t *testing.T) {
|
|
content := `
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name _;
|
|
include error_json;
|
|
}
|
|
`
|
|
pattern := regexp.MustCompile(`(?m)^\s*include\s+([^;]+);`)
|
|
matches := pattern.FindAllStringSubmatch(content, -1)
|
|
|
|
assert.Equal(t, 1, len(matches))
|
|
assert.Equal(t, "error_json", matches[0][1])
|
|
}
|