fs: Include filename in mknod errors
This commit is contained in:
parent
efec1a5e96
commit
e10e2bb50f
3 changed files with 32 additions and 6 deletions
|
@ -8,9 +8,11 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/internal/errors"
|
||||
"github.com/restic/restic/internal/restic"
|
||||
rtest "github.com/restic/restic/internal/test"
|
||||
)
|
||||
|
@ -134,3 +136,12 @@ func TestNodeFromFileInfo(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMknodError(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
// Call mkfifo, which calls mknod, as mknod may give
|
||||
// "operation not permitted" on Mac.
|
||||
err := mkfifo(d, 0)
|
||||
rtest.Assert(t, errors.Is(err, os.ErrExist), "want ErrExist, got %q", err)
|
||||
rtest.Assert(t, strings.Contains(err.Error(), d), "filename not in %q", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue