mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
remove usage of package gparser
This commit is contained in:
@ -6,11 +6,10 @@
|
||||
package gtoml_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gogf/gf/encoding/gparser"
|
||||
"github.com/gogf/gf/encoding/gjson"
|
||||
"github.com/gogf/gf/encoding/gtoml"
|
||||
"github.com/gogf/gf/test/gtest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var tomlStr string = `
|
||||
@ -43,13 +42,7 @@ func TestEncode(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
p, err := gparser.LoadContent(res)
|
||||
if err != nil {
|
||||
t.Errorf("parser failed. %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
t.Assert(p.GetString("toml"), tomlStr)
|
||||
t.Assert(gjson.New(res).Get("toml").String(), tomlStr)
|
||||
})
|
||||
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
@ -120,11 +113,7 @@ func TestToJson(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
p, err := gparser.LoadContent(res)
|
||||
if err != nil {
|
||||
t.Errorf("parser failed. %v", err)
|
||||
return
|
||||
}
|
||||
p := gjson.New(res)
|
||||
expectJson, err := p.ToJson()
|
||||
if err != nil {
|
||||
t.Errorf("parser ToJson failed. %v", err)
|
||||
|
||||
@ -8,11 +8,11 @@ package gxml_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/gogf/gf/encoding/gjson"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gogf/gf/encoding/gcharset"
|
||||
"github.com/gogf/gf/encoding/gparser"
|
||||
"github.com/gogf/gf/encoding/gxml"
|
||||
"github.com/gogf/gf/test/gtest"
|
||||
)
|
||||
@ -35,7 +35,7 @@ func buildXml(charset string, str string) (string, string) {
|
||||
head := `<?xml version="1.0" encoding="UTF-8"?>`
|
||||
srcXml := strings.Replace(head, "UTF-8", charset, -1)
|
||||
|
||||
srcParser := gparser.New(nil)
|
||||
srcParser := gjson.New(nil)
|
||||
srcParser.Set("name", str)
|
||||
srcParser.Set("age", "12")
|
||||
|
||||
|
||||
@ -7,11 +7,10 @@
|
||||
package gyaml_test
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/encoding/gjson"
|
||||
"github.com/gogf/gf/internal/json"
|
||||
"testing"
|
||||
|
||||
"github.com/gogf/gf/encoding/gparser"
|
||||
|
||||
"github.com/gogf/gf/frame/g"
|
||||
|
||||
"github.com/gogf/gf/encoding/gyaml"
|
||||
@ -113,7 +112,7 @@ func Test_ToJson(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
p, err := gparser.LoadContent(res)
|
||||
p := gjson.New(res)
|
||||
if err != nil {
|
||||
t.Errorf("parser failed. %v", err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user