mirror-yaf/config_test.go

24 lines
481 B
Go
Raw Normal View History

2020-10-27 17:17:41 +01:00
package main
import (
"testing"
)
func assertEqual[S comparable](have S, want S, t *testing.T) {
2020-10-27 17:17:41 +01:00
if have != want {
t.Error("have:", have, ", want:", want, "\n")
2020-10-27 17:17:41 +01:00
}
}
func TestConfigFromFile(t *testing.T) {
config, err := ConfigFromFile("example.conf")
if err != nil {
panic(err)
}
assertEqual(config.Port, 4711, t)
assertEqual(config.LinkPrefix, "https://jaf.example.com/", t)
assertEqual(config.FileDir, "/var/www/jaf/", t)
assertEqual(config.LinkLength, 5, t)
2020-10-27 17:17:41 +01:00
}