22 lines
623 B
Go
22 lines
623 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
|
|
package folio
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
)
|
|
|
|
func TestOnErrorStrategies(t *testing.T) {
|
|
for _, v := range []struct{ strategy OnError; expected OnError; validate error }{
|
|
{ strategy: OnErrorFail, expected: "fail", validate: nil },
|
|
{ strategy: OnErrorSkip, expected: "skip", validate: nil },
|
|
{ strategy: OnError("unknown"), expected: "", validate: ErrInvalidOnErrorStrategy },
|
|
}{
|
|
o := v.strategy
|
|
assert.Equal(t, v.expected, OnError(o.Strategy()))
|
|
assert.ErrorIs(t, o.Validate(), v.validate)
|
|
}
|
|
|
|
}
|