mirror of
https://github.com/IBM/fp-go.git
synced 2025-11-23 22:14:53 +02:00
19 lines
273 B
Go
19 lines
273 B
Go
|
|
package either
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"github.com/stretchr/testify/assert"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestCompactArray(t *testing.T) {
|
||
|
|
ar := []Either[string, string]{
|
||
|
|
Of[string]("ok"),
|
||
|
|
Left[string]("err"),
|
||
|
|
Of[string]("ok"),
|
||
|
|
}
|
||
|
|
|
||
|
|
res := CompactArray(ar)
|
||
|
|
assert.Equal(t, 2, len(res))
|
||
|
|
}
|