ceremonyclient/go-libp2p/config/config_test.go
2023-08-20 23:07:43 -05:00

24 lines
399 B
Go

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)
}
}