2023-06-05 15:41:30 +00:00
|
|
|
package fs
|
|
|
|
|
|
|
|
import (
|
2023-06-16 15:09:08 +00:00
|
|
|
"context"
|
|
|
|
"runtime"
|
2023-06-05 15:41:30 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2023-06-16 15:09:08 +00:00
|
|
|
func TestNotSpecifyingVolumeForWindowsPathErrors(t *testing.T) {
|
|
|
|
if runtime.GOOS != "windows" {
|
|
|
|
t.Skip()
|
|
|
|
}
|
2023-06-05 15:41:30 +00:00
|
|
|
|
2023-06-16 15:09:08 +00:00
|
|
|
ctx := context.Background()
|
|
|
|
pathWithVolume := `file:/c:/foo/bar`
|
|
|
|
pathWOVolume := `file:/uno/dos`
|
2023-06-05 15:41:30 +00:00
|
|
|
|
2023-06-16 15:09:08 +00:00
|
|
|
_, path, err := filerForPath(ctx, pathWithVolume)
|
2023-06-05 15:41:30 +00:00
|
|
|
assert.NoError(t, err)
|
2023-06-16 15:09:08 +00:00
|
|
|
assert.Equal(t, `/foo/bar`, path)
|
2023-06-05 15:41:30 +00:00
|
|
|
|
2023-06-16 15:09:08 +00:00
|
|
|
_, _, err = filerForPath(ctx, pathWOVolume)
|
|
|
|
assert.Equal(t, "no volume specfied for path: uno/dos", err.Error())
|
2023-06-05 15:41:30 +00:00
|
|
|
}
|