From 3e6a23b0e1b5b328419a5bb385464e667fa406f3 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 8 Nov 2020 18:01:09 +0800 Subject: [PATCH] add more unit testing case for package gview --- os/gview/gview_unit_basic_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/os/gview/gview_unit_basic_test.go b/os/gview/gview_unit_basic_test.go index 9adfb5bf2..0fcab287d 100644 --- a/os/gview/gview_unit_basic_test.go +++ b/os/gview/gview_unit_basic_test.go @@ -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) + }) +}