goext/langext/array_test.go

24 lines
444 B
Go
Raw Permalink Normal View History

2023-08-14 16:05:12 +02:00
package langext
import (
"gogs.mikescher.com/BlackForestBytes/goext/tst"
2024-06-03 09:39:57 +02:00
"strings"
2023-08-14 16:05:12 +02:00
"testing"
)
func TestJoinString(t *testing.T) {
ids := []string{"1", "2", "3"}
res := JoinString(ids, ",")
tst.AssertEqual(t, res, "1,2,3")
}
2024-06-03 09:39:57 +02:00
func TestArrPrepend(t *testing.T) {
v1 := []string{"1", "2", "3"}
v2 := ArrPrepend(v1, "4", "5", "6")
tst.AssertEqual(t, strings.Join(v1, ""), "123")
tst.AssertEqual(t, strings.Join(v2, ""), "654123")
}