make file name comparison os independant

This commit is contained in:
David Bariod 2018-10-28 18:12:32 +01:00
parent d2654b752f
commit 5a78c38d0e
1 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/json" "encoding/json"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath"
"sync" "sync"
"testing" "testing"
"time" "time"
@ -347,7 +348,7 @@ func TestNestedLoggingReportsCorrectCaller(t *testing.T) {
"github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"]) "github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"])
cwd, err := os.Getwd() cwd, err := os.Getwd()
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, cwd+"/logrus_test.go:339", fields["file"]) assert.Equal(t, filepath.ToSlash(cwd+"/logrus_test.go:340"), filepath.ToSlash(fields["file"].(string)))
buffer.Reset() buffer.Reset()
@ -376,7 +377,7 @@ func TestNestedLoggingReportsCorrectCaller(t *testing.T) {
assert.Equal(t, assert.Equal(t,
"github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"]) "github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"])
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, cwd+"/logrus_test.go:364", fields["file"]) assert.Equal(t, filepath.ToSlash(cwd+"/logrus_test.go:365"), filepath.ToSlash(fields["file"].(string)))
logger.ReportCaller = false // return to default value logger.ReportCaller = false // return to default value
} }