Fix LogURIGenerator on Windows

Checking / is not the right way to distinguish an absolute path in
Windows.

Fixes #5786.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
Kazuyoshi Kato
2022-09-16 13:14:19 -07:00
parent 290ef2b43f
commit bf26140d94
4 changed files with 167 additions and 140 deletions

View File

@@ -20,6 +20,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNewFifoSetInDir_NoTerminal(t *testing.T) {
@@ -45,3 +46,19 @@ func TestNewFifoSetInDir_Terminal(t *testing.T) {
assert.NotEmpty(t, set.Stdout, "FIFOSet.Stdout should be set")
assert.Empty(t, set.Stderr, "FIFOSet.Stderr should not be set")
}
func TestLogFileBackslash(t *testing.T) {
testcases := []struct {
path string
}{
{`C:/foo/bar.log`},
{`C:\foo\bar.log`},
}
for _, tc := range testcases {
f := LogFile(tc.path)
res, err := f("unused")
require.NoError(t, err)
assert.Equal(t, res.Config().Stdout, res.Config().Stderr)
assert.Equal(t, "file:///C:/foo/bar.log", res.Config().Stdout)
}
}