feat: add Flatten function

This commit is contained in:
dudaodong committed 2022-07-14 11:53:16 +08:00
1 parent 068c878d1e
commit 82f7401368
2 files changed
+35

No files matched your search

+8
View File
@@ -236,6 +236,14 @@ func TestFindFoundNothing(t *testing.T) {
assert.Equal(false, ok)
}
func TestFlatten(t *testing.T) {
input := [][][]string{{{"a", "b"}}, {{"c", "d"}}}
expected := [][]string{{"a", "b"}, {"c", "d"}}
assert := internal.NewAssert(t, "TestFlattenDeep")
assert.Equal(expected, Flatten(input))
}
func TestFlattenDeep(t *testing.T) {
input := [][][]string{{{"a", "b"}}, {{"c", "d"}}}
expected := []string{"a", "b", "c", "d"}