mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 17:51:33 +02:00
fn: add Sink to Result
This commit is contained in:
@@ -70,3 +70,29 @@ func TestPropTransposeResOptInverts(t *testing.T) {
|
||||
|
||||
require.NoError(t, quick.Check(f, nil))
|
||||
}
|
||||
|
||||
func TestSinkOnErrNoContinutationCall(t *testing.T) {
|
||||
called := false
|
||||
res := Err[uint8](errors.New("err")).Sink(
|
||||
func(a uint8) error {
|
||||
called = true
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
require.False(t, called)
|
||||
require.NotNil(t, res)
|
||||
}
|
||||
|
||||
func TestSinkOnOkContinuationCall(t *testing.T) {
|
||||
called := false
|
||||
res := Ok(uint8(1)).Sink(
|
||||
func(a uint8) error {
|
||||
called = true
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
require.True(t, called)
|
||||
require.Nil(t, res)
|
||||
}
|
||||
|
Reference in New Issue
Block a user