wand/internal/tests/testlib/lib.go

46 lines
603 B
Go
Raw Normal View History

2025-09-05 03:19:00 +02:00
package testlib
import (
"io"
"time"
)
type Options struct {
2025-12-10 20:31:10 +01:00
// Foo is an option.
Foo int
// Bars, any number.
Bar []string
// Duration is another option.
2025-09-05 03:19:00 +02:00
Duration time.Duration
2025-12-10 20:31:10 +01:00
// Time is the third option here.
Time time.Time
}
type OptionWithHelp struct {
// Custom help.
Help bool
2025-09-05 03:19:00 +02:00
}
// Foo sums three numbers.
2025-12-10 20:31:10 +01:00
// It prints the sum to stdout.
//
// The input numbers can be any integer.
2025-09-05 03:19:00 +02:00
func Foo(a, b, c int) int {
return a + b + c
}
func Bar(out io.Writer, a, b, c int) int {
return a + b + c
}
func Baz(o Options) int {
return o.Foo
}
2025-12-10 20:31:10 +01:00
func CustomHelp(o OptionWithHelp) {}