mirror of
https://github.com/gortc/stun.git
synced 2025-10-05 08:36:59 +08:00
27 lines
531 B
Go
27 lines
531 B
Go
package stun
|
|
|
|
import "testing"
|
|
|
|
func TestErrorCode_Reason(t *testing.T) {
|
|
codes := [...]ErrorCode{
|
|
CodeTryAlternate,
|
|
CodeBadRequest,
|
|
CodeUnauthorised,
|
|
CodeUnknownAttribute,
|
|
CodeStaleNonce,
|
|
CodeRoleConflict,
|
|
CodeServerError,
|
|
}
|
|
for _, code := range codes {
|
|
if code.Reason() == "Unknown Error" {
|
|
t.Error(code, "should not be unknown")
|
|
}
|
|
if len(code.Reason()) == 0 {
|
|
t.Error(code, "should not be blank")
|
|
}
|
|
}
|
|
if ErrorCode(999).Reason() != "Unknown Error" {
|
|
t.Error("999 error should be Unknown")
|
|
}
|
|
}
|