1
0
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:
Dr. Carsten Leue
2024-01-17 11:57:26 +01:00
parent a14feff1d6
commit 89c34254a9
2 changed files with 14 additions and 0 deletions

View File

@ -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]()))
}