mirror of
https://github.com/lyx0/yaf.git
synced 2024-11-13 19:49:53 +01:00
0d5b4543be
The value for FileDir was updated in PR #3 but we missed also updating the test in config_test.go. This is a hint that we should maybe setup a GitHub Action to run tests on PRs. :-)
29 lines
628 B
Go
29 lines
628 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func assertEqualInt(have int, want int, t *testing.T) {
|
|
if have != want {
|
|
t.Errorf("have: %d, want: %d\n", have, want)
|
|
}
|
|
}
|
|
|
|
func assertEqualString(have string, want string, t *testing.T) {
|
|
if have != want {
|
|
t.Errorf("have: %s, want: %s\n", have, want)
|
|
}
|
|
}
|
|
|
|
func TestConfigFromFile(t *testing.T) {
|
|
config, err := ConfigFromFile("example.conf")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
assertEqualInt(config.Port, 4711, t)
|
|
assertEqualString(config.LinkPrefix, "https://jaf.example.com/", t)
|
|
assertEqualString(config.FileDir, "/var/www/jaf/", t)
|
|
assertEqualInt(config.LinkLength, 5, t)
|
|
}
|