udp_test.go 297 B

123456789101112131415161718
  1. package udp
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestUdpPacket(t *testing.T) {
  7. assert := assert.New(t)
  8. buf := []byte("hello world")
  9. udpMsg := NewUDPPacket(buf, nil, nil)
  10. newBuf, err := GetContent(udpMsg)
  11. assert.NoError(err)
  12. assert.EqualValues(buf, newBuf)
  13. }