mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 04:08:15 +08:00
test: use require for immediate test failure on errors
- Replace assert with require for error checks to ensure test failures immediately halt execution Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
parent
92ce464992
commit
1dca635ea2
@ -242,9 +242,9 @@ func TestResponseWriterHijackAfterWriteHeaderNow(t *testing.T) {
|
||||
_, _, hijackErr := w.Hijack()
|
||||
|
||||
if tc.expectError == nil {
|
||||
assert.NoError(t, hijackErr, "expected hijack to succeed")
|
||||
require.NoError(t, hijackErr, "expected hijack to succeed")
|
||||
} else {
|
||||
assert.ErrorIs(t, hijackErr, tc.expectError, "unexpected error from Hijack()")
|
||||
require.ErrorIs(t, hijackErr, tc.expectError, "unexpected error from Hijack()")
|
||||
}
|
||||
assert.Equal(t, tc.expectHijackSuccess, hijacker.hijacked, "unexpected hijacker.hijacked state")
|
||||
assert.Equal(t, tc.expectWrittenAfterHijack, w.Written(), "unexpected w.Written() state after hijack")
|
||||
|
Loading…
x
Reference in New Issue
Block a user