gomega v1.2.0 Release Notes
-
๐ Improvements:
- โ Added
BeSent
which attempts to send a value down a channel and fails if the attempt blocks. Can be paired withEventually
to safely send a value down a channel with a timeout. - โ
ฮฉ
,Expect
,Eventually
, andConsistently
now immediatelypanic
if there is no registered fail handler. This is always a mistake that can hide failing tests. Receive()
no longer errors when passed a closed channel, it's perfectly fine to attempt to read from a closed channel so ฮฉ(c).Should(Receive()) always fails and ฮฉ(c).ShoudlNot(Receive()) always passes with a closed channel.- โ Added
HavePrefix
andHaveSuffix
matchers. ghttp
can now handle concurrent requests.- โ Added
Succeed
which allows one to writeฮฉ(MyFunction()).Should(Succeed())
. - ๐ Improved
ghttp
's behavior around failing assertions and panics:- If a registered handler makes a failing assertion
ghttp
will return500
. - If a registered handler panics,
ghttp
will return500
and fail the test. This is new behavior that may cause existing code to break. This code is almost certainly incorrect and creating a false positive.
- If a registered handler makes a failing assertion
ghttp
servers can take anio.Writer
.ghttp
will write a line to the writer when each request arrives.- โ Added
WithTransform
matcher to allow munging input data before feeding into the relevant matcher - โ Added boolean
And
,Or
, andNot
matchers to allow creating composite matchers - โ Added
gbytes.TimeoutCloser
,gbytes.TimeoutReader
, andgbytes.TimeoutWriter
- these are convenience wrappers that timeout if the underlying Closer/Reader/Writer does not return within the alloted time. - โ Added
gbytes.BufferReader
- this constructs agbytes.Buffer
that asynchronously reads the passed-inio.Reader
into its buffer.
๐ Bug Fixes:
- gexec:
session.Wait
now usesEventuallyWithOffset
to get the right line number in the failure. ContainElement
no longer bails if a passed-in matcher errors.
- โ Added