Skip to content
Snippets Groups Projects
Commit 30fb7e5f authored by 高辛格's avatar 高辛格
Browse files

fix issue88 based on os info

parent 4a91a50a
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ package logger
import (
"fmt"
"path/filepath"
"runtime"
"testing"
"github.com/stretchr/testify/assert"
......@@ -42,7 +43,13 @@ func TestInitLog(t *testing.T) {
path, err = filepath.Abs("./logger.yml")
assert.NoError(t, err)
err = InitLog(path)
assert.Contains(t, err.Error(), fmt.Sprintf("ioutil.ReadFile(file:%s) = error:", path))
var errMsg string
if runtime.GOOS == "windows" {
errMsg = fmt.Sprintf("open %s: The system cannot find the file specified.", path)
} else {
errMsg = fmt.Sprintf("open %s: no such file or directory", path)
}
assert.EqualError(t, err, fmt.Sprintf("ioutil.ReadFile(file:%s) = error:%s", path, errMsg))
err = InitLog("./log.yml")
assert.NoError(t, err)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment