1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-12 00:32:27 +08:00

feat: add Flatten function

This commit is contained in:
dudaodong
2022-07-14 11:53:16 +08:00
parent 068c878d1e
commit 82f7401368
2 changed files with 35 additions and 0 deletions

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"}