mirror of
https://github.com/taigrr/godns
synced 2025-01-18 04:03:25 -08:00
24 lines
411 B
Go
24 lines
411 B
Go
package godns
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestLoadSetting(t *testing.T) {
|
|
var settings Settings
|
|
err := LoadSettings("./config_sample.json", &settings)
|
|
|
|
if err != nil {
|
|
t.Error(err.Error())
|
|
}
|
|
|
|
if settings.IPUrl == "" {
|
|
t.Error("cannot load ip_url from config file")
|
|
}
|
|
|
|
err = LoadSettings("./file/does/not/exists", &settings)
|
|
if err == nil {
|
|
t.Error("file doesn't exist, should return error")
|
|
}
|
|
}
|