go-ceph/errutil/strerror_test.go
John Mulligan 887dec1c50 errutil: common error handling functions
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 16:59:25 +01:00

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, "")
}