grim/gobnc
Clone
Summary
Browse
Changes
Graph
Just cleaning up old incomplete commits
draft
2020-04-27, Gary Kramlich
289b2d7f32b6
Just cleaning up old incomplete commits
package
server
import
(
"testing"
.
"github.com/onsi/gomega"
)
func
TestConfigValidListenAddr
(
t
*
testing
.
T
)
{
g
:=
NewGomegaWithT
(
t
)
cfg
:=
&
Config
{
Port
:
6667
,
Nick
:
"foo"
,
}
g
.
Expect
(
cfg
.
Valid
()).
To
(
BeNil
())
g
.
Expect
(
cfg
.
Addr
).
To
(
Equal
(
"127.0.0.1"
))
}
func
TestConfigValidPort
(
t
*
testing
.
T
)
{
g
:=
NewGomegaWithT
(
t
)
var
cfg
*
Config
cfg
=
&
Config
{
Nick
:
"foo"
}
g
.
Expect
(
cfg
.
Valid
()).
To
(
MatchError
(
"Invalid port 0: must be between 1 and 65535"
))
cfg
=
&
Config
{
Port
:
-
1
,
Nick
:
"foo"
}
g
.
Expect
(
cfg
.
Valid
()).
To
(
MatchError
(
"Invalid port -1: must be between 1 and 65535"
))
cfg
=
&
Config
{
Port
:
65536
,
Nick
:
"foo"
}
g
.
Expect
(
cfg
.
Valid
()).
To
(
MatchError
(
"Invalid port 65536: must be between 1 and 65535"
))
}