From b6ffc2368a77e26912d1300f7bd88f7ef6205f32 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Mon, 1 Feb 2021 22:34:53 +0900 Subject: [PATCH] Add test code --- encode_opcode_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 encode_opcode_test.go diff --git a/encode_opcode_test.go b/encode_opcode_test.go new file mode 100644 index 0000000..919a688 --- /dev/null +++ b/encode_opcode_test.go @@ -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() +}