test output
This commit is contained in:
parent
890fae55ca
commit
1b2c55d990
@ -2,10 +2,9 @@
|
|||||||
Generated with https://code.squareroundforest.org/arpio/docreflect
|
Generated with https://code.squareroundforest.org/arpio/docreflect
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package wand
|
package wand
|
||||||
|
|
||||||
import "code.squareroundforest.org/arpio/docreflect"
|
import "code.squareroundforest.org/arpio/docreflect"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools", "")
|
docreflect.Register("code.squareroundforest.org/arpio/wand/tools", "")
|
||||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Docreflect", "\nfunc(out, packageName, gopaths)")
|
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Docreflect", "\nfunc(out, packageName, gopaths)")
|
||||||
|
|||||||
@ -1,12 +1,30 @@
|
|||||||
package wand
|
package wand
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
"io"
|
||||||
|
"bytes"
|
||||||
|
)
|
||||||
|
|
||||||
func TestOutput(t *testing.T) {
|
func TestOutput(t *testing.T) {
|
||||||
// nil
|
// multiple, mixed outputs
|
||||||
// simple
|
|
||||||
// stringer
|
f0 := func() any { return nil }
|
||||||
// pointer
|
f1 := func() int { return 42 }
|
||||||
// complex
|
f2 := func() time.Duration { return 9 * time.Second }
|
||||||
// reader
|
f3 := func() *int { i := 42; return &i }
|
||||||
|
f4 := func() chan int { return make(chan int) }
|
||||||
|
f5 := func() io.Reader { return bytes.NewBufferString("foo") }
|
||||||
|
f6 := func() ([]string, int, io.Reader) {
|
||||||
|
return []string{"foo", "bar", "baz"}, 42, bytes.NewBufferString("foo")
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Run("nil", testExec(testCase{impl: f0, command: "foo"}, "", ""))
|
||||||
|
t.Run("simple", testExec(testCase{impl: f1, command: "foo"}, "", "42"))
|
||||||
|
t.Run("stringer", testExec(testCase{impl: f2, command: "foo"}, "", "9s"))
|
||||||
|
t.Run("pointer", testExec(testCase{impl: f3, command: "foo"}, "", "42"))
|
||||||
|
t.Run("complex", testExec(testCase{impl: f4, command: "foo"}, "", "chan int"))
|
||||||
|
t.Run("reader", testExec(testCase{impl: f5, command: "foo"}, "", "foo"))
|
||||||
|
t.Run("mixed", testExec(testCase{impl: f6, command: "foo"}, "", "foo\nbar\nbaz\n42\nfoo"))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user