Use errors.As in test

This commit is contained in:
jybp 2023-05-10 16:52:26 +02:00 committed by Huin
parent c99b664f99
commit 8ca2329ddb

View File

@ -2,6 +2,7 @@ package soap
import ( import (
"bytes" "bytes"
"errors"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
@ -130,8 +131,8 @@ func TestUPnPError(t *testing.T) {
if testing.Verbose() { if testing.Verbose() {
t.Logf("%+v\n", err) t.Logf("%+v\n", err)
} }
soapErr, ok := err.(*SOAPFaultError) soapErr := &SOAPFaultError{}
if !ok { if ok := errors.As(err, &soapErr); !ok {
t.Fatal("expected *SOAPFaultError") t.Fatal("expected *SOAPFaultError")
} }
if soapErr.FaultCode != "s:Client" { if soapErr.FaultCode != "s:Client" {