0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Added Assertions

Added assertions to check for the extensions in the order specified
This commit is contained in:
karthic rao 2015-06-13 15:56:29 +05:30
parent 2a166f088d
commit d7db1b9576

View file

@ -2,8 +2,8 @@ package setup
import (
"testing"
"github.com/mholt/caddy/middleware/ext"
"github.com/mholt/caddy/middleware/extensions"
)
func TestExt(t *testing.T) {
@ -20,12 +20,20 @@ func TestExt(t *testing.T) {
}
handler := mid(emptyNext)
myHandler, ok := handler.(ext.Ext)
myHandler, ok := handler.(extensions.Ext)
if !ok {
t.Fatalf("Expected handler to be type Ext, got: %#v", handler)
}
if !sameNext(myHandler.Next, emptyNext) {
t.Error("'Next' field of handler was not set properly")
if myHandler.Extensions[0] != ".html" {
t.Errorf("Expected .html in the list of Extensions")
}
if myHandler.Extensions[1] != ".htm" {
t.Errorf("Expected .htm in the list of Extensions")
}
if myHandler.Extensions[2] != ".php" {
t.Errorf("Expected .php in the list of Extensions")
}
}