Add test code

This commit is contained in:
Masaaki Goshima 2021-02-01 22:34:53 +09:00
parent 2a0d4603ea
commit b6ffc2368a
1 changed files with 18 additions and 0 deletions

18
encode_opcode_test.go Normal file
View File

@ -0,0 +1,18 @@
package json
import (
"testing"
"unsafe"
)
func TestDumpOpcode(t *testing.T) {
var v interface{} = 1
header := (*interfaceHeader)(unsafe.Pointer(&v))
typ := header.typ
typeptr := uintptr(unsafe.Pointer(typ))
codeSet, err := encodeCompileToGetCodeSet(typeptr)
if err != nil {
t.Fatal(err)
}
codeSet.code.dump()
}