refactor: group parser functions

This commit is contained in:
debugtalk
2022-01-06 17:17:19 +08:00
parent 75ff0962c9
commit cfad6cee59
6 changed files with 179 additions and 169 deletions

View File

@@ -1,55 +1,9 @@
package hrp
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestLocatePlugin(t *testing.T) {
cwd, _ := os.Getwd()
_, err := locatePlugin(cwd)
if !assert.Error(t, err) {
t.Fail()
}
_, err = locatePlugin("")
if !assert.Error(t, err) {
t.Fail()
}
startPath := "examples/debugtalk.so"
_, err = locatePlugin(startPath)
if !assert.Nil(t, err) {
t.Fail()
}
startPath = "examples/demo.json"
_, err = locatePlugin(startPath)
if !assert.Nil(t, err) {
t.Fail()
}
startPath = "examples/"
_, err = locatePlugin(startPath)
if !assert.Nil(t, err) {
t.Fail()
}
startPath = "examples/plugin/debugtalk.go"
_, err = locatePlugin(startPath)
if !assert.Nil(t, err) {
t.Fail()
}
startPath = "/abc"
_, err = locatePlugin(startPath)
if !assert.Error(t, err) {
t.Fail()
}
}
func TestHttpRunner(t *testing.T) {
testcase1 := &TestCase{
Config: NewConfig("TestCase1").