feat: call function

This commit is contained in:
debugtalk
2021-10-03 10:04:29 +08:00
parent fd4837c852
commit bb9456cc7f
3 changed files with 51 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package httpboomer
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
@@ -278,3 +279,16 @@ func TestMergeVariables(t *testing.T) {
t.Fail()
}
}
func TestCallFunction(t *testing.T) {
funcName := "sleep"
params := []interface{}{1}
timeStart := time.Now()
_, err := callFunction(funcName, params)
if !assert.Nil(t, err) {
t.Fail()
}
if !assert.Greater(t, time.Since(timeStart), time.Duration(1)*time.Second) {
t.Fail()
}
}