From 4bd7608d851fd8a1e375dbc9ceba9d3f9daf2fc3 Mon Sep 17 00:00:00 2001 From: Fedor Korotkiy Date: Thu, 5 Mar 2020 23:57:41 +0300 Subject: [PATCH] Fix --- otp/cipher_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/otp/cipher_test.go b/otp/cipher_test.go index 2090dc6..f84a1a7 100644 --- a/otp/cipher_test.go +++ b/otp/cipher_test.go @@ -121,6 +121,8 @@ func (w *errWriter) Write(p []byte) (n int, err error) { } n = len(p) + w.n -= n + if w.n == 0 { err = iotest.ErrTimeout } @@ -137,7 +139,7 @@ func TestWriterError(t *testing.T) { n, err := w.Write(plaintext) require.Equalf(t, plaintextBackup, plaintext, "Write must not modify the slice data, even temporarily.") - require.NoError(t, err) + require.Equal(t, err, iotest.ErrTimeout) require.Equal(t, 512, n) require.Equal(t, out.buf.Bytes(), ciphertext[:512]) }