diff options
author | RJ Dellecese <rjdellecese@gmail.com> | 2019-12-30 14:08:44 -0500 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-12-30 22:36:04 +0000 |
commit | 0963c69598a617d30d88a412bd4fc392338c4cb4 (patch) | |
tree | 558cddcb5d73c25bdf9195f68f5dc0ce4ce143bd /test | |
parent | 10af1307dddc5cb89596c92d3fbb5a8c4491eec1 (diff) | |
download | gleam_stdlib-0963c69598a617d30d88a412bd4fc392338c4cb4.tar.gz gleam_stdlib-0963c69598a617d30d88a412bd4fc392338c4cb4.zip |
Update changelog and alpha order
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/function_test.gleam | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/test/gleam/function_test.gleam b/test/gleam/function_test.gleam index 86ef9a6..5b3ca42 100644 --- a/test/gleam/function_test.gleam +++ b/test/gleam/function_test.gleam @@ -1,28 +1,10 @@ import gleam/expect -import gleam/function.{flip, compose} +import gleam/function.{compose, flip} import gleam/int as int_mod import gleam/list import gleam/result import gleam/string as string_mod -pub fn flip_test() { - let fun = fn(string: String, int: Int) { - string - |> string_mod.append("String: '", _) - |> string_mod.append(_, "', Int: '") - |> string_mod.append(_, int_mod.to_string(int)) - |> string_mod.append(_, "'") - } - - let flipped_fun = flip(fun) - - fun("Bob", 1) - |> expect.equal(_, "String: 'Bob', Int: '1'") - - flipped_fun(2, "Alice") - |> expect.equal(_, "String: 'Alice', Int: '2'") -} - pub fn compose_test() { let add_two = fn(int: Int) { int + 2 } let add_three = fn(int: Int) { int + 3 } @@ -52,3 +34,21 @@ pub fn compose_test() { |> head_to_string |> expect.equal(_, "0") } + +pub fn flip_test() { + let fun = fn(string: String, int: Int) { + string + |> string_mod.append("String: '", _) + |> string_mod.append(_, "', Int: '") + |> string_mod.append(_, int_mod.to_string(int)) + |> string_mod.append(_, "'") + } + + let flipped_fun = flip(fun) + + fun("Bob", 1) + |> expect.equal(_, "String: 'Bob', Int: '1'") + + flipped_fun(2, "Alice") + |> expect.equal(_, "String: 'Alice', Int: '2'") +} |