fix: gutil.IsMap judgment logic error (#2953)

This commit is contained in:
the harder the luckier
2023-09-13 19:30:02 +08:00
committed by GitHub
parent e684eae878
commit ef1e18df19
2 changed files with 6 additions and 0 deletions

View File

@ -9,6 +9,7 @@ package gvar_test
import (
"testing"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/test/gtest"
)
@ -144,6 +145,10 @@ func TestVar_IsMap(t *testing.T) {
t.Assert(g.NewVar(int8(1)).IsMap(), false)
t.Assert(g.NewVar(uint8(1)).IsMap(), false)
})
gtest.C(t, func(t *gtest.T) {
t.Assert(gvar.New(gvar.New("asd")).IsMap(), false)
t.Assert(gvar.New(&g.Map{"k": "v"}).IsMap(), true)
})
}
func TestVar_IsStruct(t *testing.T) {