2 * Copyright (c) 2018 ZTE Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * and the Apache License 2.0 which both accompany this distribution,
6 * and are available at http://www.eclipse.org/legal/epl-v10.html
7 * and http://www.apache.org/licenses/LICENSE-2.0
10 * ZTE - initial Project
21 func TestCheckLogDir(t *testing.T) {
35 path: `.` + util.PathSep + `test` + util.PathSep + `test.log`,
40 for _, cas := range cases {
43 index := strings.LastIndex(cas.path, util.PathSep)
44 if cas.exist && !util.FileExists(cas.path[0:index]) {
45 t.Errorf("checkLogDir() => dir not exist, want %s", cas.path)
53 func TestLoadCustom(t *testing.T) {
59 path: `..` + util.PathSep + "conf" + util.PathSep + cfgFileName,
64 want: "read file error",
68 want: "parse config file error",
72 for _, cas := range cases {
73 res := loadCustom(cas.path)
75 if (res == nil && cas.want == "success") || (res != nil && cas.want != "success") {
76 t.Errorf("loadCustom() => want %s, got %v", cas.want, res)