mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-25 13:38:19 -05:00
groupware: finalize JMAP events integration test, with multiple changes to the model to conform with draft-ietf-calext-jscalendarbis-10 and fields that are currently not implemented in Stalwart
This commit is contained in:
@@ -224,3 +224,19 @@ func AnyItem[K comparable, V any](m map[K]V, predicate func(K, V) bool) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func Concat[E any](arys ...[]E) []E {
|
||||
l := 0
|
||||
for _, ary := range arys {
|
||||
l += len(ary)
|
||||
}
|
||||
r := make([]E, l)
|
||||
|
||||
i := 0
|
||||
for _, ary := range arys {
|
||||
if ary != nil {
|
||||
i += copy(r[i:], ary)
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -164,3 +164,10 @@ func TestAnyItem(t *testing.T) {
|
||||
assert.False(t, AnyItem(map[string]bool{"a": true, "b": false}, never))
|
||||
assert.False(t, AnyItem(nil, never))
|
||||
}
|
||||
|
||||
func TestConcat(t *testing.T) {
|
||||
assert.Equal(t, []string{"a", "b", "c", "d", "e", "f"}, Concat([]string{"a", "b"}, []string{"c"}, []string{"d", "e", "f"}))
|
||||
assert.Equal(t, []string{"a"}, Concat([]string{"a"}))
|
||||
assert.Equal(t, []string{"a"}, Concat([]string{}, nil, []string{"a"}))
|
||||
assert.Equal(t, []string{}, Concat[string]())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user