package vfserror import ( "errors" "testing" ) func TestVFSError(t *testing.T) { t.Parallel() err := NewVFSError("open", "k1", ErrNotFound) if err == nil { t.Fatal("nil error") } if !errors.Is(err, ErrNotFound) { t.Error("should unwrap to ErrNotFound") } if err.Key != "k1" || err.Op != "open" { t.Errorf("bad fields: %+v", err) } } func TestVFSErrorWithSize(t *testing.T) { t.Parallel() err := NewVFSErrorWithSize("create", "big", 12345, ErrCapacityExceeded) if err.Size != 12345 { t.Errorf("size = %d, want 12345", err.Size) } if err.Error() == "" { t.Error("Error() empty") } }