fix test cases on Windows

on Windows f.Readdir returns no error if f is closed

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2024-02-17 13:41:40 +01:00
parent 849f0bd0a8
commit e2ff12c589
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF

View file

@ -1129,9 +1129,13 @@ func TestListerAt(t *testing.T) {
err = lister.Close()
require.NoError(t, err)
n, err = lister.ListAt(files, 0)
require.Error(t, err)
require.NotErrorIs(t, err, io.EOF)
require.Equal(t, 0, n)
if runtime.GOOS == "windows" {
assert.NoError(t, err)
} else {
assert.Error(t, err)
assert.NotErrorIs(t, err, io.EOF)
require.Equal(t, 0, n)
}
lister, err = conn.ListDir("/")
require.NoError(t, err)
lister.Add(vfs.NewFileInfo("..", true, 0, time.Unix(0, 0), false))