Files
redis-go/config/config_test.go
2025-02-03 18:57:33 +08:00

28 lines
429 B
Go

package config
import (
"strings"
"testing"
)
func TestParse(t *testing.T) {
src := "bind 0.0.0.0\n" +
"port 6399\n" +
"appendonly yes\n" +
"peers a,b"
p := parse(strings.NewReader(src))
if p == nil {
t.Error("cannot get result")
return
}
if p.Bind != "0.0.0.0" {
t.Error("string parse failed")
}
if p.Port != 6399 {
t.Error("int parse failed")
}
if !p.AppendOnly {
t.Error("bool parse failed")
}
}