Add expr source

This commit is contained in:
Alex X
2023-10-26 21:07:48 +03:00
parent f291f1d827
commit b5be4ce03b
7 changed files with 178 additions and 23 deletions

17
pkg/expr/expr_test.go Normal file
View File

@@ -0,0 +1,17 @@
package expr
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestMatchHost(t *testing.T) {
v, err := Run(`
let url = "rtsp://user:pass@192.168.1.123/cam/realmonitor?...";
let host = match(url, "//[^/]+")[0][2:];
host
`)
require.Nil(t, err)
require.Equal(t, "user:pass@192.168.1.123", v)
}