mirror of
https://github.com/IBM/fp-go.git
synced 2025-06-17 00:07:49 +02:00
fix: add Join
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@ -18,6 +18,7 @@ package string
|
||||
import (
|
||||
"testing"
|
||||
|
||||
A "github.com/IBM/fp-go/array"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@ -25,3 +26,13 @@ func TestEmpty(t *testing.T) {
|
||||
assert.True(t, IsEmpty(""))
|
||||
assert.False(t, IsEmpty("Carsten"))
|
||||
}
|
||||
|
||||
func TestJoin(t *testing.T) {
|
||||
|
||||
x := Join(",")(A.From("a", "b", "c"))
|
||||
assert.Equal(t, x, x)
|
||||
|
||||
assert.Equal(t, "a,b,c", Join(",")(A.From("a", "b", "c")))
|
||||
assert.Equal(t, "a", Join(",")(A.From("a")))
|
||||
assert.Equal(t, "", Join(",")(A.Empty[string]()))
|
||||
}
|
||||
|
Reference in New Issue
Block a user