mirror of
https://github.com/lyx0/yaf.git
synced 2024-11-13 19:49:53 +01:00
172fff0edb
Notably, this requires us to bump the Go version in order to use generics. We now use Go 1.19.
23 lines
481 B
Go
23 lines
481 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func assertEqual[S comparable](have S, want S, t *testing.T) {
|
|
if have != want {
|
|
t.Error("have:", have, ", want:", want, "\n")
|
|
}
|
|
}
|
|
|
|
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)
|
|
}
|