8f982278d2
* add multimodule * re-package modules
28 lines
682 B
Go
28 lines
682 B
Go
package error
|
|
|
|
import (
|
|
"errors"
|
|
"strconv"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewGenericError(t *testing.T) {
|
|
for i, tc := range []struct {
|
|
arg []any
|
|
message string
|
|
}{
|
|
{arg: []any{"Foo"}, message: "Dummy: Foo"},
|
|
{arg: []any{"Foo%s", "Bar"}, message: "Dummy: FooBar"},
|
|
{arg: []any{errors.New("Error")}, message: "Dummy: Error"},
|
|
{arg: []any{errors.New("Error"), "Foo"}, message: "Dummy: Foo: Error"},
|
|
{arg: []any{errors.New("Error"), "Foo%s", "Bar"}, message: "Dummy: FooBar: Error"},
|
|
} {
|
|
t.Run(strconv.Itoa(i), func(t *testing.T) {
|
|
err := newGenericError(ErrDummy, tc.arg...)
|
|
assert.EqualError(t, err, tc.message)
|
|
})
|
|
}
|
|
}
|