mirror of
https://github.com/gortc/stun.git
synced 2025-09-27 04:45:55 +08:00
26 lines
588 B
Go
26 lines
588 B
Go
package stun
|
|
|
|
import "testing"
|
|
|
|
func TestDecodeErr(t *testing.T) {
|
|
err := newDecodeErr("parent", "children", "message")
|
|
if !err.IsPlace(DecodeErrPlace{Parent: "parent", Children: "children"}) {
|
|
t.Error("isPlace test failed")
|
|
}
|
|
if !err.IsPlaceParent("parent") {
|
|
t.Error("parent test failed")
|
|
}
|
|
if !err.IsPlaceChildren("children") {
|
|
t.Error("children test failed")
|
|
}
|
|
if err.Error() != "BadFormat for parent/children: message" {
|
|
t.Error("bad Error string")
|
|
}
|
|
}
|
|
|
|
func TestError_Error(t *testing.T) {
|
|
if Error("error").Error() != "error" {
|
|
t.Error("bad Error string")
|
|
}
|
|
}
|