mirror of
https://github.com/gortc/stun.git
synced 2025-10-05 16:47:09 +08:00
all: update client and server
This commit is contained in:
25
attribute_errorcode_test.go
Normal file
25
attribute_errorcode_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package stun
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestErrorCode_Reason(t *testing.T) {
|
||||
codes := [...]ErrorCode{
|
||||
CodeTryAlternate,
|
||||
CodeBadRequest,
|
||||
CodeUnauthorised,
|
||||
CodeUnknownAttribute,
|
||||
CodeStaleNonce,
|
||||
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")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user