mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
fix incorrect usage of errors.Is
errors.Is is supposed to used for equality of errors, not for type assertions. That's what errors.As is there for.
This commit is contained in:
parent
a887f8f436
commit
dbb517858e
10 changed files with 37 additions and 133 deletions
|
@ -60,7 +60,7 @@ var _ = Describe("Packet Unpacker", func() {
|
|||
opener := mocks.NewMockLongHeaderOpener(mockCtrl)
|
||||
cs.EXPECT().GetHandshakeOpener().Return(opener, nil)
|
||||
_, err := unpacker.Unpack(hdr, time.Now(), data)
|
||||
Expect(errors.Is(err, &headerParseError{})).To(BeTrue())
|
||||
Expect(err).To(BeAssignableToTypeOf(&headerParseError{}))
|
||||
var headerErr *headerParseError
|
||||
Expect(errors.As(err, &headerErr)).To(BeTrue())
|
||||
Expect(err).To(MatchError("Packet too small. Expected at least 20 bytes after the header, got 19"))
|
||||
|
@ -77,9 +77,7 @@ var _ = Describe("Packet Unpacker", func() {
|
|||
opener := mocks.NewMockShortHeaderOpener(mockCtrl)
|
||||
cs.EXPECT().Get1RTTOpener().Return(opener, nil)
|
||||
_, err := unpacker.Unpack(hdr, time.Now(), data)
|
||||
Expect(errors.Is(err, &headerParseError{})).To(BeTrue())
|
||||
var headerErr *headerParseError
|
||||
Expect(errors.As(err, &headerErr)).To(BeTrue())
|
||||
Expect(err).To(BeAssignableToTypeOf(&headerParseError{}))
|
||||
Expect(err).To(MatchError("Packet too small. Expected at least 20 bytes after the header, got 19"))
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue