package config import ( "io/ioutil" "os" "testing" ) var confs = `# log [log] logpath = "" maxsize = 10 compress = true maxage = 7 maxbackups = 10 loglevel = "info" format = "text" [db] drivename = "mysql" dsn = "root:=PDT49#80Z!RVv52_z@tcp(192.168.3.217:4000)/crocodile?charset=utf8mb4&parseTime=True&loc=Local" ` func TestInit(t *testing.T) { testfile := "/tmp/crocodile.toml" ioutil.WriteFile(testfile, []byte(confs), 0644) Init(testfile) t.Logf("%+v", Conf.DB) os.Remove(testfile) }