refactor: move LoadFile to hrp/loader

This commit is contained in:
lilong.129
2024-08-19 22:42:53 +08:00
parent a9b864dc96
commit 89d0d4bb96
13 changed files with 106 additions and 109 deletions
-28
View File
@@ -5,8 +5,6 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
)
const (
@@ -175,32 +173,6 @@ func TestGenDemoTestCase(t *testing.T) {
}
}
func TestLoadCase(t *testing.T) {
tcJSON := &TestCase{}
tcYAML := &TestCase{}
err := builtin.LoadFile(demoTestCaseWithPluginJSONPath, tcJSON)
if !assert.NoError(t, err) {
t.Fatal()
}
err = builtin.LoadFile(demoTestCaseWithPluginYAMLPath, tcYAML)
if !assert.NoError(t, err) {
t.Fatal()
}
if !assert.Equal(t, tcJSON.Config.Name, tcYAML.Config.Name) {
t.Fatal()
}
if !assert.Equal(t, tcJSON.Config.BaseURL, tcYAML.Config.BaseURL) {
t.Fatal()
}
if !assert.Equal(t, tcJSON.Steps[1].Name, tcYAML.Steps[1].Name) {
t.Fatal()
}
if !assert.Equal(t, tcJSON.Steps[1].Request, tcYAML.Steps[1].Request) {
t.Fatal()
}
}
func TestConvertCheckExpr(t *testing.T) {
exprs := []struct {
before string