/* * @Author: Bartuccio Antoine * @Date: 2018-07-23 16:08:28 * @Last Modified by: klmp200 * @Last Modified time: 2018-07-23 19:23:49 */ package settings import ( "testing" ) func TestLoadSettings(t *testing.T) { if LoadSettings("", "") == nil { t.Error("no error for inexstant main settings file") } if LoadSettings("../settings.json", "") != nil { t.Error("error for existant and well formated main settings file") } if LoadSettings("../settings.json", "settings.go") != nil { t.Error("error for malformed custom settings json, should have ignored") } if LoadSettings("../settings.json", "../settings.json") != nil { t.Error("error but everything should be fine") } if token, ok := Settings["token"]; !ok { t.Error("token not loaded") } else if token != "INSERT TOKEN HERE" { t.Error("token is not \"INSERT TOKEN HERE\"") } } func TestLoadJson(t *testing.T) { t.Log("testing loadJson") if loadJson("") == nil { t.Error("no error for empty json") } if loadJson("../settings.json") != nil { t.Error("error while loading settings.json") } if loadJson("settings.go") == nil { t.Error("no error for malformed json") } }