diff options
author | Alice Dee <alice.dee@guardian.co.uk> | 2019-05-11 17:16:06 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-05-11 17:22:56 +0100 |
commit | f7d6fe3105fbf650f0f0f95568aca801048f6d15 (patch) | |
tree | ed60af8c3017a5c6b820a8f7f500eff8360f1d56 /test | |
parent | 1d91cb03285269794823843e54ae3dbb43e7c4d6 (diff) | |
download | gleam_stdlib-f7d6fe3105fbf650f0f0f95568aca801048f6d15.tar.gz gleam_stdlib-f7d6fe3105fbf650f0f0f95568aca801048f6d15.zip |
Adds split to list stdlib
Diffstat (limited to 'test')
-rw-r--r-- | test/list_test.gleam | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/list_test.gleam b/test/list_test.gleam index fb32387..2311365 100644 --- a/test/list_test.gleam +++ b/test/list_test.gleam @@ -312,3 +312,23 @@ pub fn repeat_test() { list:repeat("x", 5) |> expect:equal(_, ["x", "x", "x", "x", "x"]) } + +pub fn split_test() { + list:split([], 0) + |> expect:equal(_, {[], []}) + + list:split([0, 1, 2, 3, 4], 0) + |> expect:equal(_, {[], [0, 1, 2, 3, 4]}) + + list:split([0, 1, 2, 3, 4], -2) + |> expect:equal(_, {[], [0, 1, 2, 3, 4]}) + + list:split([0, 1, 2, 3, 4], 1) + |> expect:equal(_, {[0], [1, 2, 3, 4]}) + + list:split([0, 1, 2, 3, 4], 3) + |> expect:equal(_, {[0, 1, 2], [3, 4]}) + + list:split([0, 1, 2, 3, 4], 9) + |> expect:equal(_, {[0, 1, 2, 3, 4], []}) +} |