summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-08-06 20:03:43 +0700
committerShulhan <ms@kilabit.info>2021-08-06 20:03:43 +0700
commit7a94740956e9a018a81a8fb05dadbc9be4ef4810 (patch)
treee1ab0ddced990f29afb6037ba7b9c502ed92a598
parentdaa6c7dc238bcdd2026441d559ad7f130c5056e0 (diff)
downloadpakakeh.go-7a94740956e9a018a81a8fb05dadbc9be4ef4810.tar.xz
lib/http: update the errors.As test on EndpointResponse
Test errors.As with uninitialized variable of *errors.E.
-rw-r--r--lib/http/endpoint_response_test.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/http/endpoint_response_test.go b/lib/http/endpoint_response_test.go
index 05d7deef..1df9a24b 100644
--- a/lib/http/endpoint_response_test.go
+++ b/lib/http/endpoint_response_test.go
@@ -32,7 +32,16 @@ func TestEndpointResponse_errors_As(t *testing.T) {
Error: err,
}
- errInternal := &liberrors.E{}
- got := errors.As(epr.Error, &errInternal)
+ var (
+ errIn *liberrors.E
+ errIn2 = &liberrors.E{}
+ )
+
+ got := errors.As(epr.Error, &errIn)
+ test.Assert(t, "EndpointRequest: errors.As", true, got)
+ test.Assert(t, "errors.As with unintialized E:", errIn, &myres.E)
+
+ got = errors.As(epr.Error, &errIn2)
test.Assert(t, "EndpointRequest: errors.As", true, got)
+ test.Assert(t, "errors.As with initialized E:", errIn2, &myres.E)
}