diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/go/testing%2Fiotest%2Findex.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/go/testing%2Fiotest%2Findex.html')
| -rw-r--r-- | devdocs/go/testing%2Fiotest%2Findex.html | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/devdocs/go/testing%2Fiotest%2Findex.html b/devdocs/go/testing%2Fiotest%2Findex.html deleted file mode 100644 index 353a62e9..00000000 --- a/devdocs/go/testing%2Fiotest%2Findex.html +++ /dev/null @@ -1,39 +0,0 @@ -<h1> Package iotest </h1> <ul id="short-nav"> -<li><code>import "testing/iotest"</code></li> -<li><a href="#pkg-overview" class="overviewLink">Overview</a></li> -<li><a href="#pkg-index" class="indexLink">Index</a></li> -<li><a href="#pkg-examples" class="examplesLink">Examples</a></li> -</ul> <h2 id="pkg-overview">Overview </h2> <p>Package iotest implements Readers and Writers useful mainly for testing. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav"> -<li><a href="#pkg-variables">Variables</a></li> -<li><a href="#DataErrReader">func DataErrReader(r io.Reader) io.Reader</a></li> -<li><a href="#ErrReader">func ErrReader(err error) io.Reader</a></li> -<li><a href="#HalfReader">func HalfReader(r io.Reader) io.Reader</a></li> -<li><a href="#NewReadLogger">func NewReadLogger(prefix string, r io.Reader) io.Reader</a></li> -<li><a href="#NewWriteLogger">func NewWriteLogger(prefix string, w io.Writer) io.Writer</a></li> -<li><a href="#OneByteReader">func OneByteReader(r io.Reader) io.Reader</a></li> -<li><a href="#TestReader">func TestReader(r io.Reader, content []byte) error</a></li> -<li><a href="#TimeoutReader">func TimeoutReader(r io.Reader) io.Reader</a></li> -<li><a href="#TruncateWriter">func TruncateWriter(w io.Writer, n int64) io.Writer</a></li> -</ul> <div id="pkg-examples"> <h3>Examples</h3> <dl> <dd><a class="exampleLink" href="#example_ErrReader">ErrReader</a></dd> </dl> </div> <h3>Package files</h3> <p> <span>logger.go</span> <span>reader.go</span> <span>writer.go</span> </p> <h2 id="pkg-variables">Variables</h2> <p>ErrTimeout is a fake timeout error. </p> -<pre data-language="go">var ErrTimeout = errors.New("timeout")</pre> <h2 id="DataErrReader">func <span>DataErrReader</span> </h2> <pre data-language="go">func DataErrReader(r io.Reader) io.Reader</pre> <p>DataErrReader changes the way errors are handled by a Reader. Normally, a Reader returns an error (typically EOF) from the first Read call after the last piece of data is read. DataErrReader wraps a Reader and changes its behavior so the final error is returned along with the final data, instead of in the first call after the final data. </p> -<h2 id="ErrReader">func <span>ErrReader</span> <span title="Added in Go 1.16">1.16</span> </h2> <pre data-language="go">func ErrReader(err error) io.Reader</pre> <p>ErrReader returns an <span>io.Reader</span> that returns 0, err from all Read calls. </p> <h4 id="example_ErrReader"> <span class="text">Example</span> -</h4> <p>Code:</p> <pre class="code" data-language="go">// A reader that always returns a custom error. -r := iotest.ErrReader(errors.New("custom error")) -n, err := r.Read(nil) -fmt.Printf("n: %d\nerr: %q\n", n, err) - -</pre> <p>Output:</p> <pre class="output" data-language="go">n: 0 -err: "custom error" -</pre> <h2 id="HalfReader">func <span>HalfReader</span> </h2> <pre data-language="go">func HalfReader(r io.Reader) io.Reader</pre> <p>HalfReader returns a Reader that implements Read by reading half as many requested bytes from r. </p> -<h2 id="NewReadLogger">func <span>NewReadLogger</span> </h2> <pre data-language="go">func NewReadLogger(prefix string, r io.Reader) io.Reader</pre> <p>NewReadLogger returns a reader that behaves like r except that it logs (using <span>log.Printf</span>) each read to standard error, printing the prefix and the hexadecimal data read. </p> -<h2 id="NewWriteLogger">func <span>NewWriteLogger</span> </h2> <pre data-language="go">func NewWriteLogger(prefix string, w io.Writer) io.Writer</pre> <p>NewWriteLogger returns a writer that behaves like w except that it logs (using <span>log.Printf</span>) each write to standard error, printing the prefix and the hexadecimal data written. </p> -<h2 id="OneByteReader">func <span>OneByteReader</span> </h2> <pre data-language="go">func OneByteReader(r io.Reader) io.Reader</pre> <p>OneByteReader returns a Reader that implements each non-empty Read by reading one byte from r. </p> -<h2 id="TestReader">func <span>TestReader</span> <span title="Added in Go 1.16">1.16</span> </h2> <pre data-language="go">func TestReader(r io.Reader, content []byte) error</pre> <p>TestReader tests that reading from r returns the expected file content. It does reads of different sizes, until EOF. If r implements <span>io.ReaderAt</span> or <span>io.Seeker</span>, TestReader also checks that those operations behave as they should. </p> -<p>If TestReader finds any misbehaviors, it returns an error reporting them. The error text may span multiple lines. </p> -<h2 id="TimeoutReader">func <span>TimeoutReader</span> </h2> <pre data-language="go">func TimeoutReader(r io.Reader) io.Reader</pre> <p>TimeoutReader returns <a href="#ErrTimeout">ErrTimeout</a> on the second read with no data. Subsequent calls to read succeed. </p> -<h2 id="TruncateWriter">func <span>TruncateWriter</span> </h2> <pre data-language="go">func TruncateWriter(w io.Writer, n int64) io.Writer</pre> <p>TruncateWriter returns a Writer that writes to w but stops silently after n bytes. </p><div class="_attribution"> - <p class="_attribution-p"> - © Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br> - <a href="http://golang.org/pkg/testing/iotest/" class="_attribution-link">http://golang.org/pkg/testing/iotest/</a> - </p> -</div> |
