mirror of
https://github.com/ceph/go-ceph
synced 2024-12-24 23:22:33 +00:00
6b396f70b2
Moving the errutil pkg to "internal/errutil" makes errutil private-like and accessible to only other go-ceph packages. The functions it provided were always meant to be used only by go-ceph, this just makes it more official. This is a breaking change but it was only available to outside users for 1 release and it is somewhat doubtful users outside of go-ceph would have reached for these functions. Signed-off-by: John Mulligan <jmulligan@redhat.com>
33 lines
603 B
Go
33 lines
603 B
Go
package errutil
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestFormatError(t *testing.T) {
|
|
e, msg := FormatErrno(39)
|
|
assert.Equal(t, 39, e)
|
|
assert.Equal(t, msg, "Directory not empty")
|
|
|
|
e, msg = FormatErrno(-5)
|
|
assert.Equal(t, 5, e)
|
|
assert.Equal(t, msg, "Input/output error")
|
|
|
|
e, msg = FormatErrno(345)
|
|
assert.Equal(t, 345, e)
|
|
assert.Equal(t, msg, "")
|
|
}
|
|
|
|
func TestStrError(t *testing.T) {
|
|
msg := StrError(39)
|
|
assert.Equal(t, msg, "Directory not empty")
|
|
|
|
msg = StrError(-5)
|
|
assert.Equal(t, msg, "Input/output error")
|
|
|
|
msg = StrError(345)
|
|
assert.Equal(t, msg, "")
|
|
}
|