add more unit testing case for package gview

This commit is contained in:
John
2020-11-08 18:01:09 +08:00
parent ee8d2afe58
commit 3e6a23b0e1

View File

@ -386,3 +386,17 @@ func Test_BuildInFuncMaps(t *testing.T) {
t.Assert(r, ` 0:john 99.9 1:smith 100 `)
})
}
func Test_BuildInFuncDump(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
v := gview.New()
v.Assign("v", g.Map{
"name": "john",
"score": 100,
})
r, err := v.ParseContent("{{dump .}}")
t.Assert(err, nil)
t.Assert(gstr.Contains(r, `"name": "john"`), true)
t.Assert(gstr.Contains(r, `"score": 100`), true)
})
}