fakePort is a scripted SerialReadWriter for tests. Each Read call returns the next chunk in chunks; SetReadTimeout is recorded.
| 80 | // fakePort is a scripted SerialReadWriter for tests. Each Read call returns |
| 81 | // the next chunk in chunks; SetReadTimeout is recorded. |
| 82 | type fakePort struct { |
| 83 | chunks [][]byte |
| 84 | idx int |
| 85 | written []byte |
| 86 | timeout time.Duration |
| 87 | // timeoutSequence captures every SetReadTimeout call so tests can |
| 88 | // assert ordering (e.g. drain installs short then restores). |
| 89 | timeoutSequence []time.Duration |
| 90 | } |
| 91 | |
| 92 | func (f *fakePort) Read(b []byte) (int, error) { |
| 93 | if f.idx >= len(f.chunks) { |
nothing calls this directly
no outgoing calls
no test coverage detected