mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-06 20:32:44 +08:00
55 lines
1.0 KiB
Go
55 lines
1.0 KiB
Go
package hrp
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestLocateFile(t *testing.T) {
|
|
// specify target file path
|
|
_, err := locateFile(tmpl("plugin/debugtalk.go"), PluginGoSourceFile)
|
|
if !assert.Nil(t, err) {
|
|
t.Fatal()
|
|
}
|
|
|
|
// specify path with the same dir
|
|
_, err = locateFile(tmpl("plugin/debugtalk.py"), PluginGoSourceFile)
|
|
if !assert.Nil(t, err) {
|
|
t.Fatal()
|
|
}
|
|
|
|
// specify target file path dir
|
|
_, err = locateFile(tmpl("plugin/"), PluginGoSourceFile)
|
|
if !assert.Nil(t, err) {
|
|
t.Fatal()
|
|
}
|
|
|
|
// specify wrong path
|
|
_, err = locateFile(".", PluginGoSourceFile)
|
|
if !assert.Error(t, err) {
|
|
t.Fatal()
|
|
}
|
|
_, err = locateFile("/abc", PluginGoSourceFile)
|
|
if !assert.Error(t, err) {
|
|
t.Fatal()
|
|
}
|
|
}
|
|
|
|
func TestLocatePythonPlugin(t *testing.T) {
|
|
_, err := locatePlugin(tmpl("plugin/debugtalk.py"))
|
|
if !assert.Nil(t, err) {
|
|
t.Fatal()
|
|
}
|
|
}
|
|
|
|
func TestLocateGoPlugin(t *testing.T) {
|
|
buildHashicorpGoPlugin()
|
|
defer removeHashicorpGoPlugin()
|
|
|
|
_, err := locatePlugin(tmpl("debugtalk.bin"))
|
|
if !assert.Nil(t, err) {
|
|
t.Fatal()
|
|
}
|
|
}
|