2018-01-26 18:43:28 +00:00
|
|
|
package example
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/mholt/caddy"
|
|
|
|
)
|
|
|
|
|
2018-02-25 08:52:52 +00:00
|
|
|
// TestSetup tests the various things that should be parsed by setup.
|
|
|
|
// Make sure you also test for parse errors.
|
|
|
|
func TestSetup(t *testing.T) {
|
2018-01-26 18:43:28 +00:00
|
|
|
c := caddy.NewTestController("dns", `example`)
|
|
|
|
if err := setup(c); err != nil {
|
|
|
|
t.Fatalf("Expected no errors, but got: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
c = caddy.NewTestController("dns", `example more`)
|
|
|
|
if err := setup(c); err == nil {
|
|
|
|
t.Fatalf("Expected errors, but got: %v", err)
|
|
|
|
}
|
|
|
|
}
|