git.gammaspectra.live/P2Pool/go-json@v0.99.0/internal/encoder/encode_opcode_test.go (about)

     1  package encoder
     2  
     3  import (
     4  	"testing"
     5  	"unsafe"
     6  )
     7  
     8  func TestDumpOpcode(t *testing.T) {
     9  	ctx := TakeRuntimeContext()
    10  	defer ReleaseRuntimeContext(ctx)
    11  	var v interface{} = 1
    12  	header := (*emptyInterface)(unsafe.Pointer(&v))
    13  	typ := header.typ
    14  	typeptr := uintptr(unsafe.Pointer(typ))
    15  	codeSet, err := CompileToGetCodeSet(ctx, typeptr)
    16  	if err != nil {
    17  		t.Fatal(err)
    18  	}
    19  	codeSet.EscapeKeyCode.Dump()
    20  }