package log
import (
- "apiroute/util"
+ "msb2pilot/util"
"os"
"strings"
"testing"
)
func TestCheckLogDir(t *testing.T) {
- pathSep := string(os.PathSeparator)
cases := []struct {
path string
exist bool
exist: false,
},
{
- path: `.` + pathSep + `test` + pathSep + `test.log`,
+ path: `.` + util.PathSep + `test` + util.PathSep + `test.log`,
exist: true,
},
}
for _, cas := range cases {
checkLogDir(cas.path)
- index := strings.LastIndex(cas.path, pathSep)
+ index := strings.LastIndex(cas.path, util.PathSep)
if cas.exist && !util.FileExists(cas.path[0:index]) {
t.Errorf("checkLogDir() => dir not exist, want %s", cas.path)
}
}
func TestLoadCustom(t *testing.T) {
- pathSep := string(os.PathSeparator)
cases := []struct {
path string
want string
}{
{
- path: `..` + pathSep + "conf" + pathSep + cfgFileName,
+ path: `..` + util.PathSep + "conf" + util.PathSep + cfgFileName,
want: "success",
},
{