aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2019-11-24 22:20:28 +0000
committerLouis Pilfold <louis@lpil.uk>2019-11-25 11:22:45 +0000
commit662ec9c6ccfb5d42892b00a638932d901abcd2e3 (patch)
treec6d7610a372acf8b89d319183f2d41654b8b5921
parent8da3face61c0ba1fe714996fb48d7ac679aaa2ad (diff)
downloadgleam_stdlib-662ec9c6ccfb5d42892b00a638932d901abcd2e3.tar.gz
gleam_stdlib-662ec9c6ccfb5d42892b00a638932d901abcd2e3.zip
Reformat list tests for clarity
-rw-r--r--test/gleam/list_test.gleam33
1 files changed, 22 insertions, 11 deletions
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam
index a24fe5b..3b6d2ff 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -352,39 +352,50 @@ pub fn repeat_test() {
}
pub fn split_test() {
- list.split([], 0)
+ []
+ |> list.split(_, 0)
|> expect.equal(_, struct([], []))
- list.split([0, 1, 2, 3, 4], 0)
+ [0, 1, 2, 3, 4]
+ |> list.split(_, 0)
|> expect.equal(_, struct([], [0, 1, 2, 3, 4]))
- list.split([0, 1, 2, 3, 4], -2)
+ [0, 1, 2, 3, 4]
+ |> list.split(_, -2)
|> expect.equal(_, struct([], [0, 1, 2, 3, 4]))
- list.split([0, 1, 2, 3, 4], 1)
+ [0, 1, 2, 3, 4]
+ |> list.split(_, 1)
|> expect.equal(_, struct([0], [1, 2, 3, 4]))
- list.split([0, 1, 2, 3, 4], 3)
+ [0, 1, 2, 3, 4]
+ |> list.split(_, 3)
|> expect.equal(_, struct([0, 1, 2], [3, 4]))
- list.split([0, 1, 2, 3, 4], 9)
+ [0, 1, 2, 3, 4]
+ |> list.split(_, 9)
|> expect.equal(_, struct([0, 1, 2, 3, 4], []))
}
pub fn split_while_test() {
- list.split_while([], fn(x) { x <= 5 })
+ []
+ |> list.split_while(_, fn(x) { x <= 5 })
|> expect.equal(_, struct([], []))
- list.split_while([1, 2, 3, 4, 5], fn(x) { x <= 5 })
+ [1, 2, 3, 4, 5]
+ |> list.split_while(_, fn(x) { x <= 5 })
|> expect.equal(_, struct([1, 2, 3, 4, 5], []))
- list.split_while([1, 2, 3, 4, 5], fn(x) { x == 2 })
+ [1, 2, 3, 4, 5]
+ |> list.split_while(_, fn(x) { x == 2 })
|> expect.equal(_, struct([], [1, 2, 3, 4, 5]))
- list.split_while([1, 2, 3, 4, 5], fn(x) { x <= 3 })
+ [1, 2, 3, 4, 5]
+ |> list.split_while(_, fn(x) { x <= 3 })
|> expect.equal(_, struct([1, 2, 3], [4, 5]))
- list.split_while([1, 2, 3, 4, 5], fn(x) { x <= -3 })
+ [1, 2, 3, 4, 5]
+ |> list.split_while(_, fn(x) { x <= -3 })
|> expect.equal(_, struct([], [1, 2, 3, 4, 5]))
}