add test
This commit is contained in:
parent
5f10a92c36
commit
c791986143
@ -1,6 +1,9 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
func TestWebConfig_SocketAddress(t *testing.T) {
|
func TestWebConfig_SocketAddress(t *testing.T) {
|
||||||
web := &webConfig{
|
web := &webConfig{
|
||||||
@ -52,6 +55,18 @@ func TestWebConfig_ContextRootInvalid(t *testing.T) {
|
|||||||
t.Fatal("Should've panicked because the configuration specifies an invalid context root")
|
t.Fatal("Should've panicked because the configuration specifies an invalid context root")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWebConfig_ContextRootNonParseable(t *testing.T) {
|
||||||
|
defer func() { recover() }()
|
||||||
|
|
||||||
|
web := &webConfig{
|
||||||
|
ContextRoot: "/invalid" + string([]byte{0x7F}) + "/",
|
||||||
|
}
|
||||||
|
|
||||||
|
web.validateAndSetDefaults()
|
||||||
|
|
||||||
|
t.Fatal(fmt.Sprintf("Should've panicked because the configuration specifies an invalid context root %s", web.ContextRoot))
|
||||||
|
}
|
||||||
|
|
||||||
func TestWebConfig_ContextRootMultiPath(t *testing.T) {
|
func TestWebConfig_ContextRootMultiPath(t *testing.T) {
|
||||||
const expected = "/app/status/"
|
const expected = "/app/status/"
|
||||||
web := &webConfig{
|
web := &webConfig{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user