mirror of
https://github.com/IBM/fp-go.git
synced 2025-06-17 00:07:49 +02:00
19 lines
312 B
Go
19 lines
312 B
Go
![]() |
package errors
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestOnError(t *testing.T) {
|
||
|
onError := OnError("Failed to process [%s]", "filename")
|
||
|
|
||
|
err := fmt.Errorf("Cause")
|
||
|
|
||
|
err1 := onError(err)
|
||
|
|
||
|
assert.Equal(t, "Failed to process [filename], Caused By: Cause", err1.Error())
|
||
|
}
|