forked from rabbitmq/amqp091-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shared_test.go
48 lines (38 loc) · 870 Bytes
/
shared_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) 2021 VMware, Inc. or its affiliates. All Rights Reserved.
// Copyright (c) 2012-2021, Sean Treadway, SoundCloud Ltd.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package amqp091
import (
"io"
"testing"
)
type pipe struct {
r *io.PipeReader
w *io.PipeWriter
}
func (p pipe) Read(b []byte) (int, error) {
return p.r.Read(b)
}
func (p pipe) Write(b []byte) (int, error) {
return p.w.Write(b)
}
func (p pipe) Close() error {
p.r.Close()
p.w.Close()
return nil
}
type logIO struct {
t *testing.T
prefix string
proxy io.ReadWriteCloser
}
func (log *logIO) Read(p []byte) (n int, err error) {
return log.proxy.Read(p)
}
func (log *logIO) Write(p []byte) (n int, err error) {
return log.proxy.Write(p)
}
func (log *logIO) Close() (err error) {
return log.proxy.Close()
}