You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
399 B

package config
import (
"testing"
)
func TestNilOption(t *testing.T) {
var cfg Config
optsRun := 0
opt := func(c *Config) error {
optsRun++
return nil
}
if err := cfg.Apply(nil); err != nil {
t.Fatal(err)
}
if err := cfg.Apply(opt, nil, nil, opt, opt, nil); err != nil {
t.Fatal(err)
}
if optsRun != 3 {
t.Fatalf("expected to have handled 3 options, handled %d", optsRun)
}
}