feature. See also
. The project being documented here (as the example) is the Zig library itself.
Client.testReadError
fn testReadError(input_buf: []const u8, tls_version: tls.ProtocolVersion, cipher: tls.ApplicationCipher) ReadError
File
Code
fn testReadError(input_buf: []const u8, tls_version: tls.ProtocolVersion, cipher: tls.ApplicationCipher) ReadError {
var input_reader: Reader = .fixed(input_buf);
var read_buf: [tls.max_ciphertext_record_len]u8 = undefined;
var c: Client = .{
.input = &input_reader,
.reader = .{
.buffer = &read_buf,
.vtable = &.{ .stream = stream, .readVec = readVec },
.seek = 0,
.end = 0,
},
.output = undefined,
.writer = undefined,
.tls_version = tls_version,
.read_seq = 0,
.write_seq = 0,
.received_close_notify = false,
.allow_truncation_attacks = false,
.application_cipher = cipher,
.ssl_key_log = null,
};
var w: Writer = .failing;
std.testing.expectError(error.ReadFailed, c.reader.stream(&w, .unlimited)) catch
@panic("expected ReadFailed");
return c.read_err.?;
}