go-json/encode_opcode_test.go

19 lines
325 B
Go
Raw Normal View History

2021-02-01 16:34:53 +03:00
package json
import (
"testing"
"unsafe"
)
func TestDumpOpcode(t *testing.T) {
var v interface{} = 1
2021-03-13 08:12:31 +03:00
header := (*emptyInterface)(unsafe.Pointer(&v))
2021-02-01 16:34:53 +03:00
typ := header.typ
typeptr := uintptr(unsafe.Pointer(typ))
codeSet, err := encodeCompileToGetCodeSet(typeptr)
if err != nil {
t.Fatal(err)
}
codeSet.code.dump()
}