* Update Caddy to 1.0.1, and update import path This fix updates caddy to 1.0.1 and also updates the import path to github.com/caddyserver/caddy This fix fixes 2959 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Also update plugin.cfg Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update and bump zplugin.go Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
29 lines
672 B
Go
29 lines
672 B
Go
package cancel
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/caddyserver/caddy"
|
|
)
|
|
|
|
func TestSetup(t *testing.T) {
|
|
c := caddy.NewTestController("dns", `cancel`)
|
|
if err := setup(c); err != nil {
|
|
t.Errorf("Test 1, expected no errors, but got: %q", err)
|
|
}
|
|
|
|
c = caddy.NewTestController("dns", `cancel 5s`)
|
|
if err := setup(c); err != nil {
|
|
t.Errorf("Test 2, expected no errors, but got: %q", err)
|
|
}
|
|
|
|
c = caddy.NewTestController("dns", `cancel 5`)
|
|
if err := setup(c); err == nil {
|
|
t.Errorf("Test 3, expected errors, but got none")
|
|
}
|
|
|
|
c = caddy.NewTestController("dns", `cancel -1s`)
|
|
if err := setup(c); err == nil {
|
|
t.Errorf("Test 4, expected errors, but got none")
|
|
}
|
|
}
|