add more UT cases for package gview (#2072)

* CI updates

* add more UT cases for package gview
This commit is contained in:
John Guo 2022-08-18 21:06:20 +08:00 committed by GitHub
parent 26e3c7aeb8
commit 3988a7ff6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {