gitee.com/sy_183/go-common@v1.0.5-0.20231205030221-958cfe129b47/utils/io/op-writer_test.go (about)

     1  package io
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  	"time"
     7  )
     8  
     9  func TestOpWriter(t *testing.T) {
    10  	opWriter := OpWriter{}
    11  	opWriter.AppendByte(1).
    12  		AppendUint32(2).
    13  		AppendUint16(3).
    14  		AppendUint64(89).
    15  		AppendBytes([]byte{0, 0, 0, 1, 67}).
    16  		AppendUint16(3).
    17  		AppendUint64(4).
    18  		AppendString("hello world")
    19  	OpWriterAppendEmbedded(&opWriter, time.Now())
    20  	opWriter.WriteTo(os.Stdout)
    21  }