1234567891011121314151617181920212223 |
- // +build linux
- package linux
- import (
- "bytes"
- "encoding/binary"
- "testing"
- "notabug.org/themusicgod1/gosigar/sys"
- "github.com/stretchr/testify/assert"
- )
- func TestParseNetlinkErrorDataTooShort(t *testing.T) {
- assert.Error(t, ParseNetlinkError(nil), "too short")
- }
- func TestParseNetlinkErrorErrno(t *testing.T) {
- buf := new(bytes.Buffer)
- binary.Write(buf, sys.GetEndian(), -1*int32(NLE_MSG_TOOSHORT))
- assert.Equal(t, ParseNetlinkError(buf.Bytes()), NLE_MSG_TOOSHORT)
- }
|