mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 12:17:53 +08:00
add more UT cases for package gview (#2072)
* CI updates * add more UT cases for package gview
This commit is contained in:
parent
26e3c7aeb8
commit
3988a7ff6b
@ -501,6 +501,12 @@ func Test_BuildInFuncPlus(t *testing.T) {
|
||||
t.AssertNil(err)
|
||||
t.Assert(r, `6`)
|
||||
})
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
v := gview.New()
|
||||
r, err := v.ParseContent(gctx.New(), "{{1| plus 2}}")
|
||||
t.AssertNil(err)
|
||||
t.Assert(r, `3`)
|
||||
})
|
||||
}
|
||||
|
||||
func Test_BuildInFuncMinus(t *testing.T) {
|
||||
@ -510,6 +516,12 @@ func Test_BuildInFuncMinus(t *testing.T) {
|
||||
t.AssertNil(err)
|
||||
t.Assert(r, `-4`)
|
||||
})
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
v := gview.New()
|
||||
r, err := v.ParseContent(gctx.New(), "{{2 | minus 3}}")
|
||||
t.AssertNil(err)
|
||||
t.Assert(r, `1`)
|
||||
})
|
||||
}
|
||||
|
||||
func Test_BuildInFuncTimes(t *testing.T) {
|
||||
@ -519,6 +531,12 @@ func Test_BuildInFuncTimes(t *testing.T) {
|
||||
t.AssertNil(err)
|
||||
t.Assert(r, `24`)
|
||||
})
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
v := gview.New()
|
||||
r, err := v.ParseContent(gctx.New(), "{{2 | times 3}}")
|
||||
t.AssertNil(err)
|
||||
t.Assert(r, `6`)
|
||||
})
|
||||
}
|
||||
|
||||
func Test_BuildInFuncDivide(t *testing.T) {
|
||||
@ -528,6 +546,12 @@ func Test_BuildInFuncDivide(t *testing.T) {
|
||||
t.AssertNil(err)
|
||||
t.Assert(r, `2`)
|
||||
})
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
v := gview.New()
|
||||
r, err := v.ParseContent(gctx.New(), "{{2 | divide 4}}")
|
||||
t.AssertNil(err)
|
||||
t.Assert(r, `2`)
|
||||
})
|
||||
}
|
||||
|
||||
func Test_Issue1416(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user