a:addr: add UnexpectedEOF test

This commit is contained in:
Aleksandr Razumov
2017-06-25 15:26:38 +02:00
parent 08e16d29c3
commit df6350a7d0

View File

@@ -1,6 +1,7 @@
package stun
import (
"io"
"net"
"testing"
)
@@ -47,6 +48,13 @@ func TestMappedAddress(t *testing.T) {
t.Error("should error")
}
})
t.Run("Bad length", func(t *testing.T) {
message := new(Message)
message.Add(AttrMappedAddress, []byte{1, 2, 3})
if err := got.GetFrom(message); err != io.ErrUnexpectedEOF {
t.Errorf("<%s> should be <%s>", err, io.ErrUnexpectedEOF)
}
})
})
})
}