missing tests for parameter variations

This commit is contained in:
Arpad Ryszka 2026-01-08 21:22:16 +01:00
parent d3c148363d
commit ba493e77d6
2 changed files with 7 additions and 20 deletions

View File

@ -26,6 +26,9 @@ func TestApply(t *testing.T) {
f0io := func(out io.Writer, a s0, in io.Reader) { io.Copy(out, in); out.Write([]byte(a.Foo + a.Bar)) }
f1 := func(a, b, c int) int { return a + b + c }
f1a := func(a, b int, c ...int) int { return a + b + len(c) }
f1b := func(a, b, c **int) int { return **a + **b + **c }
f1c := func(a, b, c []int) int { return a[0] + b[0] + c[0] }
f1d := func(a, b, c **[]*int) int { return *(**a)[0] + *(**b)[0] + *(**c)[0] }
f2 := func(a s2) bool { return a.Foo != a.Bar }
t.Run("config", testExec(testCase{impl: f0, command: "foo", conf: "foo=bar"}, "", "bar"))
t.Run("env", testExec(testCase{impl: f0, command: "foo", env: "foo_foo=bar"}, "", "bar"))
@ -108,6 +111,10 @@ func TestApply(t *testing.T) {
"bar",
),
)
t.Run("positional in pointer", testExec(testCase{impl: f1b, command: "foo 1 2 3"}, "", "6"))
t.Run("positional in pointer", testExec(testCase{impl: f1c, command: "foo 1 2 3"}, "", "6"))
t.Run("positional in pointer", testExec(testCase{impl: f1d, command: "foo 1 2 3"}, "", "6"))
})
t.Run("output", func(t *testing.T) {

View File

@ -1,20 +0,0 @@
turn testExec into a wandtesting package
use a type cache
check the teletype width for rendering
provide option for the markdown rendering width
support HTML doc rendering
test:
- nil return values
- options in variadic
- options in pointer
- options in slice
- options in slice and pointer
- parameters in pointers
- parameters in slices
- parameters in slices and pointers
- implementation in pointer
- implementation in slice => not accepted
- implementation in pointer and slice => not accepted
- plurality
- env parsing
- plurality in input validation