mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2024-12-26 23:30:27 +08:00
21 lines
409 B
Go
21 lines
409 B
Go
package pnet
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestIsPnetErr(t *testing.T) {
|
|
err := NewError("test")
|
|
|
|
if err.Error() != "privnet: test" {
|
|
t.Fatalf("expected 'privnet: test' got '%s'", err.Error())
|
|
}
|
|
if !IsPNetError(err) {
|
|
t.Fatal("expected the pnetErr to be detected by IsPnetError")
|
|
}
|
|
if IsPNetError(errors.New("not pnet error")) {
|
|
t.Fatal("expected generic error not to be pnetError")
|
|
}
|
|
}
|