1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-08-10 22:31:32 +02:00

fix: remove Reader and ReaderEither for context since they do not make sense

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-10-23 09:05:10 +02:00
parent 08d9fed9af
commit da3c9683eb
19 changed files with 20 additions and 805 deletions

View File

@@ -25,58 +25,58 @@ import (
)
var (
testError = fmt.Errorf("error")
errFoo = fmt.Errorf("error")
)
func TestSequenceT1(t *testing.T) {
t1 := Of[MyContext, error]("s1")
e1 := Left[MyContext, string](testError)
e1 := Left[MyContext, string](errFoo)
res1 := SequenceT1(t1)
assert.Equal(t, E.Of[error](T.MakeTuple1("s1")), res1(defaultContext))
res2 := SequenceT1(e1)
assert.Equal(t, E.Left[T.Tuple1[string]](testError), res2(defaultContext))
assert.Equal(t, E.Left[T.Tuple1[string]](errFoo), res2(defaultContext))
}
func TestSequenceT2(t *testing.T) {
t1 := Of[MyContext, error]("s1")
e1 := Left[MyContext, string](testError)
e1 := Left[MyContext, string](errFoo)
t2 := Of[MyContext, error](2)
e2 := Left[MyContext, int](testError)
e2 := Left[MyContext, int](errFoo)
res1 := SequenceT2(t1, t2)
assert.Equal(t, E.Of[error](T.MakeTuple2("s1", 2)), res1(defaultContext))
res2 := SequenceT2(e1, t2)
assert.Equal(t, E.Left[T.Tuple2[string, int]](testError), res2(defaultContext))
assert.Equal(t, E.Left[T.Tuple2[string, int]](errFoo), res2(defaultContext))
res3 := SequenceT2(t1, e2)
assert.Equal(t, E.Left[T.Tuple2[string, int]](testError), res3(defaultContext))
assert.Equal(t, E.Left[T.Tuple2[string, int]](errFoo), res3(defaultContext))
}
func TestSequenceT3(t *testing.T) {
t1 := Of[MyContext, error]("s1")
e1 := Left[MyContext, string](testError)
e1 := Left[MyContext, string](errFoo)
t2 := Of[MyContext, error](2)
e2 := Left[MyContext, int](testError)
e2 := Left[MyContext, int](errFoo)
t3 := Of[MyContext, error](true)
e3 := Left[MyContext, bool](testError)
e3 := Left[MyContext, bool](errFoo)
res1 := SequenceT3(t1, t2, t3)
assert.Equal(t, E.Of[error](T.MakeTuple3("s1", 2, true)), res1(defaultContext))
res2 := SequenceT3(e1, t2, t3)
assert.Equal(t, E.Left[T.Tuple3[string, int, bool]](testError), res2(defaultContext))
assert.Equal(t, E.Left[T.Tuple3[string, int, bool]](errFoo), res2(defaultContext))
res3 := SequenceT3(t1, e2, t3)
assert.Equal(t, E.Left[T.Tuple3[string, int, bool]](testError), res3(defaultContext))
assert.Equal(t, E.Left[T.Tuple3[string, int, bool]](errFoo), res3(defaultContext))
res4 := SequenceT3(t1, t2, e3)
assert.Equal(t, E.Left[T.Tuple3[string, int, bool]](testError), res4(defaultContext))
assert.Equal(t, E.Left[T.Tuple3[string, int, bool]](errFoo), res4(defaultContext))
}
func TestSequenceT4(t *testing.T) {