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"
"io/ioutil"
"os"
"path/filepath"
"sync"
"testing"
"time"
@ -347,7 +348,7 @@ func TestNestedLoggingReportsCorrectCaller(t *testing.T) {
"github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"])
cwd, err := os.Getwd()
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()
@ -376,7 +377,7 @@ func TestNestedLoggingReportsCorrectCaller(t *testing.T) {
assert.Equal(t,
"github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"])
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
}